Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a distribution app when using xcodebuild -exportArchive (Xcode8.3, Auto Signing)?

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

like image 228
lailai Avatar asked Mar 30 '17 12:03

lailai


People also ask

How do I enable signing in Xcode?

Open the project using Xcode. Select the root project directory, and go to the Signing and Capabilities tab. Here, you can either check Automatically manage signing or do the signing manually. If you check the Automatically manage signing checkbox, then you will just need to select the Team from the drop-down list.


2 Answers

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>
like image 149
Sven Driemecker Avatar answered Nov 16 '22 02:11

Sven Driemecker


Just replace this parameter :

-exportProvisioningProfile "MyProvisioningProfile"

with:

PROVISIONING_PROFILE_SPECIFIER="MyProvisioningProfile"

Hope it helps.

like image 34
tezqa Avatar answered Nov 16 '22 01:11

tezqa