What is target membership in Xcode 4

狂风中的少年 提交于 2019-12-18 12:19:42

问题


I am searching for an example for target membership in Xcode. I am a bit confused about what it means exactly. For example, I have two different target membership. myApp and myAppTests. What does it mean if I specify a file (say myAppFile.h) to be part of myAppTests but not myApp? What happens exactly when my app build and run?

Thanks


回答1:


Generally header files are not members of targets. Making an implementation file a member of a target tells Xcode to compile the file when you build the target. In your example Xcode compiles the file myAppFile.m when you build the myAppTests target but not when you build the myApp target.

When you have an application target and a unit testing target, your application's implementation files should be members of the application target. Your unit testing classes' implementation files should be members of the unit testing target.




回答2:


For example when you create a library or framework you should create a .modulemap which includes umbrella header. Every imported header in umbrella should has a public target membership

You can setup a visibility via

`Target Membership` in the `Inspector` tab 
//or
Project Settings -> Target -> Build Phases
    .h -> Headers
    .m -> Compile Sources
    .h or umbrella.h and .modulemap -> Copy Files

Read more here



来源:https://stackoverflow.com/questions/8306003/what-is-target-membership-in-xcode-4

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