Reputation: 1035
Yesterday I have upgraded from Xcode 8.1 to 8.3.2 and of course all my CI build infrastructure failed again (thanks Apple, you always know how to make me even more busier!).
So, the main destructive change is that -exportProvisioningProfile
is no longer a valid option. As I understand they're now forcing us to use -exportOptionsPlist
instead.
I already configured exporting for one of my apps to use .plist file with app-store
method for market only.
For any AdHoc exports I was happy to use -exportProvisioningProfile "$PROVISIONING_PROFILE"
. No idea why Apple decided it is bad.
Hence, now I have to modify my automated build script to use .plist file for ANY exports.
I was able to find out from xcodebuild -help
and from other questions here on SO that I need to set method to ad-hoc
for internal distribution. Okay, this is easy, but...
how the hell can I specify the exact provisioning profile to be used for IPA export?
I am able to choose the desired profile when exporting from GUI, so I believe there should be some way to pass it to xcodebuild
. However, I still haven't found any ways to do this on the web.
Thanks in advance guys.
p.s. please don't suggest to use automatic profile management, I have several profiles for exporting dedicated to their own purposes, I need to say which one of them to use in particular situation explicitly (my bash script defines it when build process starts).
Upvotes: 5
Views: 4618
Reputation: 3501
You can't directly specify the Provisioning Profile for IPA export anymore, instead you have to specify the parameters for teamID
and method
in the exportOptions.plist, so xcodebuild will be able to resolve the desired Provisioning Profile for you:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>ad-hoc</string>
<key>teamID</key>
<string>YOUR_TEN_CHARACTER_TEAM_ID</string>
</dict>
</plist>
You can look up your teamID in the Provisioning Profile (key TeamIdentifier
)
If the Provisioning Profile used to build the xcarchive uses the same teamID as your export Provisioning Profile, you don't have to necessarily set the teamID param in the plist, but it's always a good idea.
Be sure to copy your AdHoc Prov Profile to $HOME/Library/MobileDevice/Provisioning Profiles
so xcodebuild will be able to find it.
EDIT
If you have multiple Prov Profiles in $HOME/Library/MobileDevice/Provisioning Profiles
that all match the combination of method, teamID and the app's bundle identifier, you'll have two options:
$HOME/Library/MobileDevice/Provisioning Profiles
before each export so it will only contain the desired profile. Move the current contents away (cp -Rpf "$HOME/Library/MobileDevice/Provisioning Profiles" "$HOME/Library/MobileDevice/Provisioning Profiles Backup" && rm -f "$HOME/Library/MobileDevice/Provisioning Profiles/"*.mobileprovision
), then copy your export profile to the dir, export the ipa and restore the backup folder.xcodebuild -exportArchive ... PROVISIONING_PROFILE_SPECIFIER=xxx
, content should be the value of the Name
key of the Prov Profile's internal plist. This behavior is undocumented, so it may not work in all Xcode > 7 versions. It also may not work when your app contains embedded extensions, as they may require a separate Prov Profile. Upvotes: 7