13

After update Xcode8.3, the options '-exportSigningIdentity', '-exportProvisioningProfile' and '-exportFormat' are removed from 'xcodebuild -exportArchive'.

When i try to get a distribution app, i get the error below:
xcodebuild: error: invalid option '-exportProvisioningProfile'.

So how can i get distribution MyApp.ipa from MyApp.xcarchive, when the project has set Automatic Signing Enabled?

Automatic Signing

Community
  • 1
  • 1
lailai
  • 161
  • 1
  • 1
  • 7

3 Answers3

28

Sounds like you want to create an IPA on the command line from an existing xcarchive. Since Xcode 7, the preferred way to do this is (from man xcodebuild):

xcodebuild -exportArchive -archivePath xcarchivepath -exportPath destinationpath -exportOptionsPlist path

So in your case:

xcodebuild -exportArchive -archivePath MyApp.xcarchive -exportPath MyApp.ipa -exportOptionsPlist exportOptions.plist

exportOptions.plist is a PLIST file that contains various parameters configuring the IPA export. See xcodebuild -help for all available options. You'll have to at least specifiy an entry for method (app-store, ad-hoc, enterprise etc. - defaults to development). If you just want to export for App-Store distribution, the file should look like this:

<?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>app-store</string>
</dict>
</plist>
Sven Driemecker
  • 3,421
  • 1
  • 20
  • 22
  • I converted my command lines and everything works except push ... i am not sure it use good provisioning profile ... i have lot of targets with différents provisioning profile in my project and I tried to find a solution for 2 days... nothing. Will install older version of xCode .. – Beber May 16 '17 at 13:14
2

Just replace this parameter :

-exportProvisioningProfile "MyProvisioningProfile"

with:

PROVISIONING_PROFILE_SPECIFIER="MyProvisioningProfile"

Hope it helps.

tezqa
  • 139
  • 8
0

When you set Automatic Signing Enabled Xcode will automatically generate according provisioning profile.

But in order to make your command working you need to manually export the archive the first time. Once it is done, Xcode will generate the provisioning profile (it starts by "XC" in the Apple Developer website).

Then your xcodebuild command will work.

Product -> Archive

Once it's done

Windows -> Organizer -> Select the last version -> Export (right pannel under Upload to App Store)

Keep me inform if you need additional informations.

  • If i use build system(like jenkins), How can this work? – lailai Apr 01 '17 at 03:23
  • It will work once you have done it at least one time manually. In order to make Xcode generate your provisioning profile. –  Apr 03 '17 at 08:51