如何使用Xcode4项目模板向复制绑定资源构建阶段添加文件

时间:2022-10-30 14:03:05

I'm working on an Xcode 4 project template and I'm struggling with controlling the files that get added to the Copy Bundle Resources build phase--header files get added that I do not want to be copied into the project bundle and a file that I do want to be copied does not appear in this list (a custom .framework file that contains both the static library and image resources).

我工作在一个Xcode 4项目模板,我挣扎在控制文件被添加到复制包资源构建阶段——头文件补充道,我不想被复制到项目包和一个文件,我想复制不出现在这个列表(自定义.framework文件,其中包含静态库和图像资源)。

It seems like Xcode automatically builds contents of this build phase from the Nodes section in the project template; if it's a .framework, it automatically gets added to the linked libraries, if it's a .m, it automatically gets added to compiled sources, and everything else gets added to the Copy Bundle Resources.

看起来Xcode从项目模板的节点部分自动构建这个构建阶段的内容;如果是。framework,它会自动添加到链接库中,如果是。m,它会自动添加到已编译的源代码中,其他所有内容都会添加到Copy Bundle资源中。

I'd be grateful for any direction on this one!

我很感激在这方面的任何指导!

Update: To clarify, I'm attempting to create an Xcode project template that, when used, creates a new Xcode project that includes the specified files from the template in the Copy Bundle Resources build phase.

更新:为了澄清这一点,我正在尝试创建一个Xcode项目模板,当使用该模板时,将创建一个新的Xcode项目,其中包含来自Copy Bundle Resources构建阶段模板的指定文件。

2 个解决方案

#1


1  

如何使用Xcode4项目模板向复制绑定资源构建阶段添加文件

This should help. After the Class-Resources key-value pair, you can add files somehow. I couldn't figure that out but I'm sure you can find it somewhere.

这应该帮助。在类资源键-值对之后,您可以以某种方式添加文件。我不知道,但我肯定你能在某个地方找到它。

EDIT: Actually, i think an easier way is to in the Definition part, after the Path key, add a TargetIndices key (an array). With some experimenting you should be able to find out what value to put on one item of that array to put it in the Copy Bundle Resources build phase.

编辑:实际上,我认为更简单的方法是在定义部分,在路径键之后,添加一个TargetIndices键(数组)。通过一些实验,您应该能够找出在该数组的一个条目上放置什么值,以便将其放到Copy Bundle Resources构建阶段。

#2


1  

Yes, Xcode tries to manage this for you. If after adding a file, it did not did what you want, then change it. It's guesses are "usually" correct "most" of the time. :)

是的,Xcode试图为您管理这个。如果添加了一个文件,它没有做你想做的事情,然后改变它。猜测大多数时候是“通常”正确的。:)

#1


1  

如何使用Xcode4项目模板向复制绑定资源构建阶段添加文件

This should help. After the Class-Resources key-value pair, you can add files somehow. I couldn't figure that out but I'm sure you can find it somewhere.

这应该帮助。在类资源键-值对之后,您可以以某种方式添加文件。我不知道,但我肯定你能在某个地方找到它。

EDIT: Actually, i think an easier way is to in the Definition part, after the Path key, add a TargetIndices key (an array). With some experimenting you should be able to find out what value to put on one item of that array to put it in the Copy Bundle Resources build phase.

编辑:实际上,我认为更简单的方法是在定义部分,在路径键之后,添加一个TargetIndices键(数组)。通过一些实验,您应该能够找出在该数组的一个条目上放置什么值,以便将其放到Copy Bundle Resources构建阶段。

#2


1  

Yes, Xcode tries to manage this for you. If after adding a file, it did not did what you want, then change it. It's guesses are "usually" correct "most" of the time. :)

是的,Xcode试图为您管理这个。如果添加了一个文件,它没有做你想做的事情,然后改变它。猜测大多数时候是“通常”正确的。:)