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

2

3

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).

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.

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.

Regimentals answered 29/8, 2011 at 21:59 Comment(0)
C
1

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.

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.

Crispy answered 23/9, 2011 at 21:0 Comment(0)
F
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. :)

Fakery answered 29/8, 2011 at 22:10 Comment(3)
Ideally, I'd like to create a project template that correctly sets up the build phases.Regimentals
Templates don't dictate the ongoing behaviour of Xcode, only the initial state. If your problem is that when adding files to the project they end up in the wrong phase then a template won't help you. Though for the record, Xcode always gets .h files for me. It's .fsh and .vsh (common extensions for GL ES 2 shaders, which are compiled at runtime by the GL driver) that it always gets wrong, insisting on trying to compile them rather than copying them into the bundle.Meagre
I will clarify my question, but my problem is related solely to the initial state of Xcode: I'd like to create a template that starts a new project that has specified files in the Copy Bundle Resources build phase.Regimentals
C
1

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.

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.

Crispy answered 23/9, 2011 at 21:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.