tags:

views:

4982

answers:

2

I'm a little confused how this works - this is my understanding:

  • A target's provisioning profile is linked to a specific app ID
  • The bundle identifier for a target is found under Target info\Properies\Identifier

But... bundle ID is also located in Info.plist. It seems that if you change the bundle ID in Info.plist, Xcode changes it automatically in Target info\Properties\Identifier, and vice versa.

So which is it that takes precedence? The Target info\Properties\Identifier bundle ID or the Info.plist bundle ID?

The reason I ask is because I'd like to have two versions for my app - a free ad supported version and a paid version, and I'd like to accomplish that with two different targets. Since they will be two different apps in the App Store, my understanding is they need two different app IDs (and I don't want to go down the * route with app IDs, the description of how that works on the App Store made my brain hurt).

Would I need two different Info.plists for each target if I did this, or can I use the same Info.plist, and just have the different targets use a different development/distribution provisioning profile?

+7  A: 

There isn't a precedence, the properties dialog is just serving as another way for you to see your Info.plist.

To share the plist between the targets but have different identifiers, make sure that the "Expand Build Settings in Info.plist File" option is enabled for both targets. Then, for each target, make a new user-created variable in the target settings for your bundle ID (e.g., APPLICATION_BUNDLE_IDENTIFIER) and set it to the right value for that target. In your plist, put the following for bundle ID:

<key>CFBundleIdentifier</key>
<string>$(APPLICATION_BUNDLE_IDENTIFIER)</string>

The variable will be evaluated at build time for each target, so each will get the right bundle ID.

smorgan
A: 

Doesn't work for me:

Building target “App” of project “Pro” with configuration “Beta2”

Checking Dependencies Code Sign error: Provisioning profile 'Beta2' specifies the Application Identifier 'com.xxx.beta2' which doesn't match the current setting 'APPLICATION_BUNDLE_IDENTIFIER'

EDIT: After quitting Xcode, trashing the build folder, relaunching Xcode it works now.

MarcS