iOS Bundle Identifier not being modified


I want to change the bundle identifier to sign the IPA with another provisioning profile. I used the Step “Set iOS Info.plist - Bundle Identifier” and it does not work. I also tried to do it manually adding a “Script” step and executing:

/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.mnm.BitriseTest" SpaceCells/Info.plist

Both Steps work without errors but when the step “Xcode Archive” is being executed it fails with this error:


Check dependencies
Provisioning profile "(DEV) Bitrise Test" has app ID "com.mnm.BitriseTest", which does not match the bundle ID "com.mnm.SpaceCells".
Provisioning profile "(DEV) Bitrise Test" doesn't match the entitlements file's value for the application-identifier entitlement.
Code signing is required for product type 'Application' in SDK 'iOS 10.3'

In the “Xcode Archive” step I have set all the values to force:

- ForceTeamID: 9797YGHF8
- ForceProvisioningProfileSpecifier: 9797YGHF8/(DEV) Bitrise Test
- ForceProvisioningProfile: 
- ForceCodeSignIdentity: iPhone Developer: Mario Negro (YS9B5A4L4A)
- CustomExportOptionsPlistContent:

I can’t find where the error is, and there is no more data I can gather to try to seek this error.

Did you try to run the config locally, with the Bitrise CLI?

From the log it seems that your PlistBuddy call does not set the right bundle ID; maybe the Info.plist there is not the right one (not the one which is then used during the archive) or something similar, but the log line:

Provisioning profile "(DEV) Bitrise Test" has app ID "com.mnm.BitriseTest", which does not match the bundle ID "com.mnm.SpaceCells".

Means that the provisioning profile “(DEV) Bitrise Test” has a bundle ID “com.mnm.BitriseTest”, while the xcode project does not (based on the log the bundle ID of the xcode project is “com.mnm.SpaceCells”).

Or maybe it’s because of this - if you force code signing params you force it for the whole build, so if your project includes sub projects it will be forced on those too.

Our recommendation is to never use the force options unless you really have to. Since Xcode 7 there are way better options to set the final code signing: don’t force anything and just follow this guide:

Once you upload all the signing files to the archive will work, and you just have to set the Select method for export input as described in the linked guide. That’s pretty much all. It’s the exact same process as if you’d click “Archive” in and then you’d select the export method when Xcode’s Organizer is presented.

Thank you so much for your responses @viktorbenei, but I don’t know if that would work because I suspect this is a problem of being modifying the wrong setting.

The problem is that modifying the CFBundleIdentifier setting is not enough to build outside of Xcode (modifying the Plist and building works when using Xcode), now the place to modify the bundle id is PRODUCT_BUNDLE_IDENTIFIER in the Build Settings of the target. As said in the Release Notes of Xcode 7:

The new build setting Product Bundle Identifier (PRODUCT_BUNDLE_IDENTIFIER) is the recommended place to set the Bundle Identifier for a target. The target’s Info.plist should be configured to use this build setting by referencing it as $(PRODUCT_BUNDLE_IDENTIFIER) in the value for the CFBundleIdentifier key.

Xcode offers to configure this for you when you accept the “Upgrade to recommended settings” project modernization in the issue navigator, unless your target preprocesses its Info.plist file. In that case you will need to configure this setting manually. This change is backwards-compatible to older versions of Xcode.

This change is required to make certain features work, such as On Demand Resources, if your target preprocesses its Info.plist file. (20887827)

I tested it with a Script step with this line:

sed -i '' 's/com.mnm.SpaceCells/com.mnm.BitriseTest/g' SpaceCells.xcodeproj/project.pbxproj

Now it worked perfectly, even forcing the signing in the archive step.

It will be great to have a new Step to modify this setting :slight_smile:



Definitely - feel free to create a #feature-request or create a step! :wink:

And thanks for reporting the solution, I’m sure this’ll help others in the future!

1 Like

Sure I’ll create the step! :smiley:

1 Like