什么是 Xcode 4 中的目标成员资格 [英] What is target membership in Xcode 4

查看:21
本文介绍了什么是 Xcode 4 中的目标成员资格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找 Xcode 中目标成员资格的示例.我对它的确切含义感到有些困惑.例如,我有两个不同的目标成员资格.myApp 和 myAppTests.如果我指定一个文件(比如 myAppFile.h)作为 myAppTests 的一部分而不是 myApp,这意味着什么?当我的应用构建和运行时会发生什么?

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?

谢谢

推荐答案

通常头文件不是目标的成员.使实现文件成为目标的成员会告诉 Xcode 在构建目标时编译该文件.在您的示例中,Xcode 会在您构建 myAppTests 目标时编译文件 myAppFile.m,但不会在构建 myApp 目标时编译.

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.

这篇关于什么是 Xcode 4 中的目标成员资格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆