Xcode 11 Archive and create .ipa file from command line 2020 || How to convert .xcarchive to .ipa using terminal




Generally we generate .ipa file of our project using Xcode>Product>Archive and after few minutes you will export .ipa file from organizer. 



But different scenarios we generate ipa through terminal (Command Line) using commands that Xcode uses internally.
Here is command line script for creating archive and IPA example. I have an iPhone xcode project , which is located in Desktop/demo folder.




Open Xcode Project & Select provision profile and signing certificate



Open Terminal & Execute following commands one by one:

cd /Users/username/Desktop/demo/ or drag and drop your project folder.

// Builds the app into an archive

xcodebuild -project YourProject.xcodeproj -scheme YourScheme -archivePath /Path/To/Output/YourApp.xcarchive 

For example, this is how you would use it with AppCodeZip demo app


xcodebuild archive -project demo.xcodeproj -scheme demo -archivePath /Users/shilpa/Desktop/demo.xcarchive


Execute command-



Archive Succeeded-




If your project has xcworkspace use below script



xcodebuild -workspace Project-Name.xcworkspace -scheme Scheme-Name -sdk iphoneos -configuration Release  Provisioning_Profile=“Provision-Name” Development_Team=“Team-ID” archive -archivePath /Path/To/Output/AppName.xcarchive archive



Xcarchive and Export .ipa file-


Export the archive into a .ipa file using the following command:

xcodebuild -exportArchive -archivePath /Path/To/Output/YourApp.xcarchive -exportPath /Path/To/ipa/Output/Folder -exportOptionsPlist /Path/To/ExportOptions.plist

What is ExportOptions.plist?

ExportOptions.plist is required in Xcode . It lets you to specify some options when you create an ipa file. You will need to create a plist file for the export options, using the keys and values found in the xcodebuild help page use command Run xcodebuild --help to see the list of available options.

Important: Method for development, release and enterprise is different in ExportOptions.plist

The -exportOptionsPlistoption is mandatory here, so you have to provide your own development .plist file below.



<?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>compileBitcode</key>

<false/>

<key>destination</key>

<string>export</string>

<key>method</key>

<string>development</string>

<key>provisioningProfiles</key>

<dict>

<key>bundle-identifier</key>

<string>Profile-Name-Show-In-Xcode</string>

</dict>

<key>signingCertificate</key>

<string>Apple development</string>

<key>signingStyle</key>

<string>manual</string>

<key>stripSwiftSymbols</key>

<true/>

<key>teamID</key>

<string>XXXXXXXXXX</string>

<key>thinning</key>

<string>&lt;none&gt;</string>

</dict>

</plist>



Again, this is how you would use it with AppCodeZip demo app


// Exports the archive according to the export options specified by the plist

xcodebuild -exportArchive -archivePath /Users/shilpa/Desktop/demo.xcarchive  -exportPath /Users/shilpa/Desktop/demo.ipa  -exportOptionsPlist /Users/shilpa/Downloads/ExportOptions.plist


Execute command-




Export ipa particular location



Finally i have been created ipa file upload.Now create a link and install for iPhone development testing.

How to download your iOS enterprise developer app from link?


How to generate .ipa file for In-House and distribute enterprise iOS app inside a company.

Enterprise  ExportOptions .plist file below.


<?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>compileBitcode</key>

<false/>

<key>destination</key>

<string>export</string>

<key>method</key>

<string>enterprise</string>

<key>provisioningProfiles</key>

<dict>

<key>bundle-identifier-Name</key>

<string>Profile-Name-Show-In-Xcode</string>

</dict>

<key>signingCertificate</key>

<string>Apple Distribution</string>

<key>signingStyle</key>

<string>manual</string>

<key>stripSwiftSymbols</key>

<true/>

<key>teamID</key>

<string>XXXXXXXXXX</string>

<key>thinning</key>

<string>&lt;none&gt;</string>

</dict>

</plist>



AppStore/Release ExportOptions .plist file below.


<?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>compileBitcode</key>

<false/>

<key>destination</key>

<string>export</string>

<key>method</key>

<string>app-store</string>

<key>provisioningProfiles</key>

<dict>

<key>bundle-identifier-Name</key>

<string>Profile-Name-Show-In-Xcode</string>

</dict>

<key>signingCertificate</key>

<string>Apple Distribution</string>

<key>signingStyle</key>

<string>manual</string>

<key>stripSwiftSymbols</key>

<true/>

<key>teamID</key>

<string>XXXXXXXXXX</string>

<key>thinning</key>

<string>&lt;none&gt;</string>

</dict>

</plist>



You can download ðŸ‘‰ ExportOptions.plist filefrom GitHubAs always, leave us comment and share your thought about the tutorial.

I hope this blog was helpful to you. So, please share it together with your friends and colleagues using the social buttons below!

Post a Comment

0 Comments