tags:

views:

197

answers:

3

Hi

I have two target builds in my iPhone app project, and I want to build each one with a different Default.png for the load screen. At the moment I am having to place the file with the correct name in the project folder, build, then swap it out with a different one and build the other target.

Is there an easier way?

Thanks

+1  A: 

It seems like you should be able to do this with a Custom Build Rule. See: this article. You'll definitely have to adapt what's been done. Also, I'm not sure this qualifies as easier.

If I were going this route, I'd try to insert a script into the build process that interrogates the target and copies the correct image file to Default.png.

Rob Jones
+2  A: 

If you have 2 different Default.png files, you should be able to specify explicitly which one of them each target should copy to the application bundle.

If you expand a target in Xcode, there should be 3 subcategories where one of them defines all resources that are copied. This is the category that should contain the desired Default.png. Delete it from both your targets, and then drag each Default.png into the appropriate target to make sure they both reference the correct file.

Jacob H. Hansen
In fact, I just added them both as resources, but selected the relevant target from the "add resource" options menu. Job done :)
mootymoots
+1  A: 

If you have 2 different Default.png files, you should be able to specify explicitly which one of them each target should copy to the application bundle.

If you expand a target in Xcode, there should be 3 subcategories where one of them defines all resources that are copied. This is the category that should contain the desired Default.png. Delete it from both your targets, and then drag each Default.png into the appropriate target to make sure they both reference the correct file.


Drag is ok but be careful to:

  1. uncheck "Copy items into destination group's folder"
  2. select "Relative to Enclosing Group"
  3. select the appropriate target

when adding the resource.

Is it right?

Philc