How to teach Xcode to include all header files in output of static library project?

﹥>﹥吖頭↗ 提交于 2019-11-27 04:46:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!