John Smith
John Smith

Reputation: 1172

Error Dynamically change provisioning profile with xcodebuild

I want to automate the build of an iPad app with different provisioning profile (because I have different iOS developer accounts).

I found that i can copy the provisioning profiles directly in the directory for Xcode with this:

cp packages/provisioning_profiles/*.* ~/Library/MobileDevice/Provisioning\ Profiles/

Then i check which Provisioning profile i should use:

if [[ "$SIGNING_IDENTITY" =~ "myIdentity1" ]]; then
    PROVISIONING_PROFILE="packages/application-packages/provisioning_profiles/Wildcard_ADHOC.myIdentity1.mobileprovision"
else
    PROVISIONING_PROFILE="packages/application-packages/provisioning_profiles/Wildcard_ADHOC.myIdentity2.mobileprovision"
fi

and then i try to build with Xcode build:

xcodebuild -scheme "myapp" -configuration "Archive" -sdk "iphoneos5.1" PROVISIONING_PROFILE="$PROVISIONING_PROFILE" clean CONFIGURATION_BUILD_DIR=../build 
xcodebuild -scheme "myapp" -configuration "Archive" -sdk "iphoneos5.1" PROVISIONING_PROFILE="$PROVISIONING_PROFILE" archive CONFIGURATION_BUILD_DIR=../build 

everything was working good before i tried to change dynamically the provisioning profiles, now i got this error:

Check dependencies Code Sign error: Provisioning profile '6E50482A-AD93-4A0A-B8E4-xxxxxx' can't be found

futhermore i have no idea where come from this "6E50482A-AD93-4A0A-B8E4-xxxxxx"

Someone have an idea of my problem ?

Is it possible to dynamically change the provisioning profile with xcodebuild nah ?

Upvotes: 2

Views: 2834

Answers (1)

christophercotton
christophercotton

Reputation: 5859

Yes, it is possible to have multiple provisioning profiles. I use a command line to build either with AdHoc profile or our AppStore profile. Instead of specifying the file path, you need to specify the id of the profile, which is what the "6E50482A-AD93-4A0A-B8E4-xxxxxx" is. We have our profiles installed on each of our dev machines, so you can just select the profile by specifying the id like:

if [[ "$SIGNING_IDENTITY" =~ "myIdentity1" ]]; then
    PROVISIONING_PROFILE="6E50482A-AD93-4A0A-B8E4-xxxxxx"
else
    PROVISIONING_PROFILE="97EF81AB-A345-8888-7878-xxxxxx"
fi

If you don't have the profiles installed, you will have to do a script which installs them for you on the machine and then xcode can find them. There is another answer which deals with that Provide xcodebuild with .mobileprovision file

Upvotes: 2

Related Questions