原文:http://stackoverflow.com/questions/5413338/xcode-4-and-nested-projects-header-files-not-found
Forget the whole public header thing with Xcode, it's a PITA and doesn't work correctly when archiving your app. Instead, have all static library header files on the project level and tell your app where to find it.
-
Ease your pain by making sure all targets have the same name for the build configuration (i.e. add an "AdHoc" and "Deployment" configuration to the static libraries).
-
In build settings, point the Header Search Paths (if you use
#include <file.h>
) or User Header Search Paths (if you use#include "file.h"
) to the directory of the static library project. If the static library project is inside your app directory, use this:"$(PROJECT_DIR)"
(recursive enabled)If you have a directory which contains a) the static library project and b) your app, then this should work:
"$(PROJECT_DIR)/.."
(recursive enabled) -
If the submodule contains compiled libraries, set your Library Search Paths to:
"$(TARGET_BUILD_DIR)"
-
Make sure all the static library projects that you use have Skip Install set to
YES
. -
Again, no public header files (Build Phases » Copy Headers) in any of the static libraries, otherwise Xcode will not be able to archive an app.
-
Make sure to tell Xcode when to build the static libraries, as shown in this Tech Doc from Apple.