简体   繁体   中英

Xcode 8, xcodebuild, multiple bundle ID and Provisioning Profiles

I have to start by saying if I build using Xcode, everything is fine. My goal is to use xcodebuild with Jenkins so that I can have automated builds with multiple environments. I am really confused with how Xcode 8 works with automated signing.

I started by looking at this: Use xcodebuild (Xcode 8) and automatic signing in CI (Travis/Jenkins) environments

Things started to work when I did this. However, now when I added a new bundle ID and PP, I started to get the following errors. Also, the previous build ID doesn't work either:

Building

23:06:50 Check dependencies

23:06:50 [BCEROR]No profiles for 'com.xyz' were found: Xcode couldn't find a provisioning profile matching 'com.xyz'.

23:06:50 [BCEROR]Code signing is required for product type 'Application' in SDK 'iOS 10.3'

Archiving

23:06:51 No profiles for 'com.xyz' were found: Xcode couldn't find a provisioning profile matching 'com.xyz'.

23:06:51 Code signing is required for product type 'Application' in SDK 'iOS 10.3'

23:06:51 ** ARCHIVE FAILED **

This is what I am doing:

#if the directory exist, run the command
if [ -d "~/Library/Developer/Xcode/DerivedData" ]; then
    xattr -rc ~/Library/Developer/Xcode/DerivedData
fi

#Unlock keychain
security unlock-keychain -p xxx ~/Library/Keychains/login.keychain

#Build .xarchive
xcodebuild -project ${WORKSPACE}/PATH.xcodeproj \
           -scheme X \
           -configuration Release \
           clean \
           archive -archivePath ${WORKSPACE}/.../archive.xcarchive \
           DEVELOPMENT_TEAM=XXX

#Unlock keychain
security unlock-keychain -p x ~/Library/Keychains/login.keychain

#Exporting to .ipa
    xcodebuild -exportArchive -archivePath ${WORKSPACE}/XXX/archive.xcarchive \
           -exportOptionsPlist /XXXX/exportOptions.plist \
           -exportPath ${WORKSPACE}/XXXX/Output/${Environment} \
           PROVISIONING_PROFILE_SPECIFIER="ENVIRONMENT_PP"

So I am using Unity to generate the xcode project. What I did to fix it:

In Unity, disable the automatic signing and specify the Provisioning profile hash, (I got the hash from using the editor view, and copied the value to the script):

 private static readonly string UDIDProfileHash = "HASH";

 PlayerSettings.iOS.appleEnableAutomaticSigning = false;
 PlayerSettings.iOS.appleDeveloperTeamID = "TEAMID";
 PlayerSettings.iOS.iOSManualProvisioningProfileID = UDIDProfileHash;

For the Xcodebuild syntax I removed specifying the Provisioning profile:

PROVISIONING_PROFILE_SPECIFIER="ENVIRONMENT_PP"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM