Xcode:哪些文件需要成为我的目标成员? (目标会员) [英] Xcode: Which files need to be members of my target? (Target Membership)

查看:100
本文介绍了Xcode:哪些文件需要成为我的目标成员? (目标会员)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Xcode 4.6.2中开发一个只有一个目标的iPhone应用程序,我注意到一些重要文件不是我的目标成员。我的自定义头文件都不是目标成员资格的一部分,也不是我的Info.plist,我的前缀标题或产品MyApp.app。

I'm developing an iPhone app in Xcode 4.6.2 that only has one target, and I've noticed that some important files are not members of my target. None of my custom header files are part of the target membership, nor is my Info.plist, my Prefix header, or the product "MyApp.app."

这种方式我了解目标,这些文件肯定需要成为目标成员。

The way I understand targets, these files certainly need to be members of the target.

我的问题是:为什么这些文件不是我的目标成员?

在搜索SO之后,类似的问题已经产生了一些见解,但并不完全回答这个问题。我收集的见解是:

After searching around on SO, similar questions have yielded some insight, but not a complete answer to that question. The insight I've gathered is:


  1. 标题文件不是目标的成员,因为它们在复制标题中链接构建阶段。

  1. Header files are not members of your target because they get linked in the "Copy Headers" Build Phase.


  • 这听起来很合理,但我没有复制标题构建阶段

  • This sounds reasonable, but I don't have a Copy Headers Build Phase

Info.plist和Prefix.pch不是目标的成员,因为Info.plist在复制包资源构建阶段中链接,并且Info.plist包含指向前缀头的键/值条目(Prefix.pch)

Info.plist and Prefix.pch aren't members of the target because Info.plist gets linked in the "Copy Bundle Resources" Build Phase, and the Info.plist contains a key/value entry that points to the prefix header (Prefix.pch)


  • 我是不是肯定的,这实际上是如何运作的

  • I'm not positive that this is actually how it works


推荐答案

头文件是其他源文件引用的文件,因此他们知道类的接口是什么。它们不是二进制本身的一部分,因此它们不需要包含在最终产品中。

Header files are what other source files reference so that they know what the interface for a class is. They aren't needed as part of the binary itself, so they don't need to be included in the final product.

Info.plist 是一种特殊情况,因为它定义了应用程序包本身,所以它是单独处理的。

Info.plist is a special case as it defines the application bundle itself, so it is processed separately.

一般来说,你希望文件成为你的目标:

Generally speaking, you want files to be members of your target when they:


  • 构成可执行文件的一部分(例如实现( .m )文件或库),或

  • 作为文件包含在应用程序包中(例如图像)。

  • Form part of the executable (e.g. implementation (.m) files or libraries), or
  • Are included as files in the application bundle (e.g. images).

如果文件仅用作构建过程的一部分而在运行时不需要,则不需要文件成为目标的成员。通常,这是任何类型的头文件,包括预编译头文件( .pch )。

You don't need files to be members of your target if they are only used as part of the build process and aren't needed at runtime. Typically this is any type of header file, including precompiled headers (.pch).

这篇关于Xcode:哪些文件需要成为我的目标成员? (目标会员)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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