Solution.
- Goto Project or Target's Build Settings.
- Find Public Headers Folder Path. (definition name =
PUBLIC_HEADERS_FOLDER_PATH
)
- Set it as
YourLibrary.framework/Headers
. I have used ${PRODUCT_NAME}.framework/Headers
for automatic syncing with project name.
- Goto Build Phases and find Copy Headers step.
- Move all required headers to Public pane.
Now all header files will be formed like Framework and copied with product binary. IDE will copy all of them as a unit into some temporary folder like app's build folder. So referencing app project can use the headers automatically.
This is a trick. The created directory structure is not real framework. Because it doesn't contain any binary. However we don't need real framework to archive just this functionality. IDE works with frameworks without any binary. And I don't want to hack IDE without documentation about internal structure.
This works well, however you'll experience some problem when you Archive. This happens because Xcode4 behaves specially when Archiving. Here's workaround.
- For each embedded library project,
SKIP_INSTALL = YES
in target build settings.
- For final product project,
FRAMEWORK_SEARCH_PATHS = "${OBJROOT}/UninstalledProducts"
. Take care about this setting should be set only for Release
build mode.
Now it'll be archived well.
At the case of cross platform library, there can be many projects for many platforms. But sometime Xcode will show some product as red color even it compiled successfully.
This is a bug of Xcode. IDE display depends SDKROOT
of Project build setting. So if you set the SDKROOT
differently on Target, it won't work. You can check the the product will become black color after changing the SDKROOT
of the Project build setting. See this Open Radar entry for details.
http://openradar.appspot.com/9636211
If you wish to fix this bug, please report this to Apple's Radar. Duplicated bugs will make attention of Apple. Just copy & paste my report :)