问题
I followed a tutorial to create a static library project. Then I dragged in my classes and added them to the target.
When I build & run, it creates a libUtils.a file. Upon reveal in Finder the include folder only contains the header file for the first class that Xcode created automatically when I created the project. All other header files are missing.
I double-checked: All the added class files are part of the project and the inspector shows a target membership checkmark for the target project.
Is this a bug in Xcode or must I register all files I create additionally somewhere else?
回答1:
Xcode automatically adds a build phase to copy the headers to the product directory. You can add new header files to this build phase:

Update:
You can also use "Copy Headers" build phase instead:
Editor menu > Add Build Phase > Add Copy Headers Build Phase.
And the header files will be added automatically to one of the categories when you add them to the project:

More info about this build phase and the three categories from iOS Developer Library.
回答2:
Xcode 10.2.1
Project editor -> select a target -> Build Phases -> + Add a new Build Phase -> New Header Phase
The second step is to add .h
files
through just added `Headers` Section
//or
through `Project Navigator` -> `File Inspector` -> `Target Membership`
来源:https://stackoverflow.com/questions/19202923/how-to-teach-xcode-to-include-all-header-files-in-output-of-static-library-proje