Full Stack iOS Continuous Delivery with xcodebuild and ExportOptions Plist

Published by Shashikant Jagtap on

The process of uploading the iOS binary to App Store is time-consuming and boring. On top of this, Apple didn’t provide the better options to upload the binary to App Store.  As of now, we have used various tools to upload   .ipa  files to App Store Connect. The most common method for the solo iOS developers is to uploading directly from Xcode or using Application Loader tool which comes up with Xcode. In mature companies, engineers configure Continuous Integration server to upload binary to App Store Connect using command line tools like altool,  iTMSTransporter or Fastlane deliver.  We have covered these option in our previous post in details here. Fortunately, with Xcode 10, we can upload the binary to the App Store Connect just using xcodebuild and exportOptionsPlist file. In this short post, we will see how we can achieve with Xcode 10.

Archive App

The xcodebuild has a -exportArchive option to create an IPA that works more like Xcode Organizer.There are two steps

  1. build an archive with xcodebuild archive
  2. create the .ipa with xcodebuild -exportArchive

We now build the archive like this:

We now export the .ipa like this:

These two commands create the file build/MY_APP.xcarchive  and build/MY_APP.ipa  files.

Note that the above command requires a -exportOptionsPlist  argument that points to a Plist file with export options. For a complete list of what you can put in that plist, run xcodebuild -help  The minimal contents of the file look like this:

we run this command successfully, we will have IPA file created using the specified provisioning profile. In the end, we will have our IPA, MY_APP.ipa binary ready to upload to iTunes Connect. At this point, we need to use the tools like altool,  iTMSTransporter or Fastlane deliver. to upload the binary to the AppStore. However, we don’t need these tools with Xcode 10. We can specify the upload to the App Store Connect directly from the Plist file.

Modify ExportOptions Plist for Direct Upload

With Xcode 10, we have a new option in the ExportOptions.Plist file which will enable us to upload the binary to the App Store Connect without using tools like altool,  iTMSTransporter or Fastlane deliver. The xcodebuild -exportArchive  command will perform an upload if the provided ExportOptions.plist contains a key named “destination” with value “upload“. We need to have the Apple ID account with the necessary App Store Connect role and provider membership must be added in Xcode’s Accounts preference pane. There are other distribution methods supported as well app-store”, “developer-id”, and “validation” etc. The new ExportOptions.Plist  file will look like this:

By using this ExportOptions.Plist  file, we can upload the binary directly to the App Store Connect by using xcodebuild tools and there is no need to use tools. This will be useful for the Continuous Integration workflow.


Finally, the Full Stack iOS Continuous Delivery can be achieved using xcodebuild itself. It’s time to drop some of the tools like altool, iTMSTransporter and Fastlane deliver from the CI/CD pipelines and utilise the full power of the xcodebuild to upload the binaries to the App Store Connect. Hope you will adopt this new features in your iOS CI/CD workflow very soon.