Mac framework headers and Xcode

Guides | Tutorial By 5 years ago

When developing on the Mac and using custom frameworks in your application, when you compile the frameworks are copied into your application’s bundle then linked at runtime. These frameworks will most likely be bundled up with their headers. Some of the frameworks you include may not be things you want to make public to the world, which you are essentially doing by including the headers with the framework.

I have written a small script you can add as a build phase that will remove all .h files from your frameworks after compilation.

#! /bin/bash

# Put this in a 'run script' run phase in xcode
# Delete all framework headers
cd "${BUILD_DIR}/${CONFIGURATION}/${PRODUCT_NAME}.app/Contents/Frameworks"

if [ $? = 0 ]; then
find . -name "*.h" -print0 | xargs -0 rm