My App is given one bundleID for App Store distribution. The App also has a small variant for enterprise distribution, thus with another bundleID. The automatic build uses the following command line to set bundleID and pick the right signing identify:
xcodebuild -project XYZ.xcodeproj -target XYZ -sdk "iphoneos" -configuration "Debug" BUNDLE_IDENTIFIER=<bundleID_1_or_2> CODE_SIGN_IDENTITY="<identify_1_or_2" build
This automatic build has been working great, until recently I enabled iCloud capability. Now Xcode automatically adds the following to project.pbxproj:
TargetAttributes = {
QWERTY1234567890123456 = {
DevelopmentTeam = XYZ123456;
SystemCapabilities = {
com.apple.iCloud = {
enabled = 1;
};
};
};
};
Notice the addition of a hard-coded "DevelopmentTeam = XYZ123456"; for the two builds, the DevelopmentTeam ID is different. How to automate this? An easier solution is to have a script to modify project.pbxproj before invoking xcodebuild, but I am not a fan of that solution. The next best is to create a new "User Defined Setting" thus passing it via command line, but I could not figure out how to associate the User-Defined Setting with that DevelopmentTeam ID embedded there inside project.pbxproj.
In Xcode 8 this was added as DEVELOPMENT_TEAM
build setting.
You can pass as a command line argument just like other settings:
xcodebuild
-sdk "iphoneos"
-project Foo.xcodeproj
-configuration "Debug"
...
DEVELOPMENT_TEAM=XYZ123456
See in more detail about Xcode 8 code signing changes: https://pewpewthespells.com/blog/migrating_code_signing.html