Multiple Xcode targets and info.plist

Another Xcode tip that I use a lot prompted by a question on StackOverflow.

When I have an Xcode iPhone OS project that requires multiple targets I like to create a directory for each target under the resources group. I can then place any target specific assets such as icons, data and the Info.plist file in one place. This helps a lot when it comes to selecting which items are included in which target build.

Note that the location of the Info.plist file needs to be set for each target in the build settings for the target (right-click on the target, get info and then look in the packaging section of the build tab).

A common and easy mistake to make when selecting which files are included with each target is to select the Info.plist file. This causes a build warning as follows:

Warning: The Copy Bundle Resources build phase contains this target's 
 Info.plist file 'Resources/AppTarget1/Info.plist'

If you are building for a device the codesign operation will also fail:

Command /usr/bin/codesign failed with exit code 1

The solution is easy enough, just find the offending Info.plist file and uncheck its target setting. Apple has some more details on the problem in Technical Q&A QA1649.