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.
xcrun is a tool that helps managing Xcode versions on your system. It allows you to write scripts that don't need to know where your Xcode instance or developer tools are installed. The path to the Xcode version (or developer tools) is set/read via xcode-select . You can reset it via: sudo xcode-select --reset.
In the Project navigator of the main window, select the project — the root group with the same name as your app — and in the project editor that appears, select the appropriate target and then click the Signing & Capabilities tab.
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
We were able to deal with multiple DevelopmentTeam IDs by using the sigh utility, which provides automation for provisioning profiles. We use it as part of the fastlane suite of tools.
sigh --team_id <DevelopmentTeamID>
Or as part of a fastlane automation (Fastfile):
sigh(team_id: "<DevelopmentTeamID>")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With