xcode 如何使用 Xcode4 项目模板将文件添加到复制捆绑资源构建阶段

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7236469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:50:17  来源:igfitidea点击:

How do I add files to the Copy Bundle Resources build phase with an Xcode4 Project Template

iphoneiosxcodetemplatesxcode-template

提问by Daniel

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 似乎从项目模板中的 Nodes 部分自动构建此构建阶段的内容;如果它是 .framework,它会自动添加到链接库中,如果它是 .m,它会自动添加到已编译的源中,而其他所有内容都会添加到 Copy Bundle Resources 中。

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 项目,该项目包含复制捆绑资源构建阶段模板中的指定文件。

采纳答案by mk12

screenshot

截屏

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.

这应该有帮助。在 Class-Resources 键值对之后,您可以以某种方式添加文件。我无法弄清楚,但我相信你可以在某个地方找到它。

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 键(一个数组)。通过一些试验,您应该能够找出将该数组的一项放入复制捆绑资源构建阶段的值。

回答by picciano

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 会尝试为您管理这些。如果添加文件后,它没有做你想要的,那么改变它。它的猜测在“大多数”时间“通常”是正确的。:)