1
votes

This isn't a super critical issue, but in my project, I have multiple targets for different versions of the app. I can add the 4" retina launch image "[email protected]", but I can't specify different versions of it for each target like I can the other images; changing it in one target will change it (incorrectly) in the other targets. Seems like an xcode 4.5 bug, but wanted to ask in case I've missed something. As it is, the work around is to simply change the image before each build when I switch targets. My fear is that one of these days, I'm going to forget to do that;-) Thanks.

1
You can probably solve this by editing the info.plist directly.Steven Fisher
Thanks, Steven. Any idea what the key should be? I have a single key, Icon file, and then Icon files, which has an array of values as opposed to the single value of Icon file. Aside from the image dimensions, not sure how it would "know" which one to use without specifying an explicit key? Hope that made sensewkhatch
Looking this over, this doesn't seem to work the way I remembered. Forget about the info.plist. Try instead putting the different default.pngs in different folders, and making sure your build phases copy for each target copy the right one.Steven Fisher
Let me convert this to an answer, where I can be more clear. And it'll probably be a good workaround until you find the right answer.Steven Fisher

1 Answers

1
votes

While I haven't verified the bug you describe, this seems simple enough to work around. All iOS does is look for Default.png (etc.) in your application bundle when it launches.

If you can't get the Target Info pane to do what you want, you can just override it by replacing the [email protected] after the rest of Xcode has had its way.

Here's my suggestion. You'll need to do this for each target.

  1. Move your [email protected] images to subdirectories.
  2. Add a Copy Files build phase to each target at the end.
  3. Set the build phase to copy to the Resources directory.
  4. Drag the appropriate [email protected] into the build phase.

Try this out and see if it will do what you need. If it works but gives you a build warning, you can use a Script Phase instead, and something like this:

cp ${PROJECT_DIR}/your-subdirectory-here/[email protected] \
   ${CODESIGNING_FOLDER_PATH}/[email protected]

The script phase has the advantage that you can specify the name of the destination file; you don't really need to put your images in subdirectories.

That said, unless you're comfortable with scripting I suggest you try the Copy Phase first. No point playing with something you're not comfortable with if it isn't going to work anyway.