Using Apple’s iTMS Transporter API to upload builds to TestFlight

Huishan
YNAP Tech
Published in
4 min readJul 29, 2019

We have all been there. You have just completed countless hours of dev work to get that app update ready. It is working beautifully and is ready to be released to TestFlight.

The next step: “get it live!”

Photo by Fikri Rasyid on Unsplash

But getting it live is not that simple. It can be a laborious, error-prone manual process that takes many hours. Valuable time that, if saved, could be spent on delivering value to our customers.

You’re probably thinking: “There must be a better way?” And there is.

In this article, I will share how you can automate the upload of your .ipa file to iTunes Connect using the iTMS Transporter CLI. iTMS Transporter is a command line tool that is provided by Apple to upload metadata and assets to iTunes Connect.

Here is a workflow diagram on how it is done:

If you use Application Loader or Xcode to upload your .ipa file to TestFlight, iTMS Transporter is what is being used under the hood.

iTMS Transporter comes as a part of Xcode, which means as long as you have Xcode installed, you can use the CLI to run the Transporter commands from this location:

Create the .itmsp folder

The first thing we need to do is generate the .itmsp folder to upload to iTunes Connect. The .itmsp folder will contain the metadata.xml and the .ipa files to upload. You can modify the metadata.xml file to upload assets such as screenshots or to upload the What’s New text.

Add this to your script:

Move your .ipa file into the .itmsp folder

Make sure the .ipa file is moved into the .itmsp folder by adding this to your script:

Generate the metadata.xml file

The minimum information needed in the metadata.xml file is your Apple ID, the name of the .ipa file, the size of the .ipa file and the md5 checksum:

First you need to collect this information manually and once you have done that you can automate the process via a script.

To get the Apple ID:

1. Log into your account on iTunesConnect

2. Pick the app you want to submit to the app store

3. Select the App Store tab at the top

4. Select App Information on the left

5. Under General Information, is where you can find your Apple ID and also your app SKU.

Note: If you ever need to download metadata.xml file from iTunes Connect using the iTMS Transporter command, your SKU is your Vendor ID

Run the following command to get the size of the .ipa file:

Run the following command to get the md5 checksum:

The md5 command will get the md5 checksum for the .ipa file and echo the result. The cut command takes the md5 result and awk will remove spaces in the result.

Put all this information in a script to generate the metadata.xml file. The script will contain the commands to generate the size of the file and the checksum in variables:

Note: Make sure you keep the indentation of the metadata.xml file or else it will be rejected

Upload the .itmsp folder to iTunes Connect

The last thing to add to your script once you have the .itmsp folder that contains your .ipa file and the metadata.xml file, is to upload the .itmsp folder to iTunes Connect.

In order to do this, add the following upload command that is provided by the iTMS Transporter CLI to your script:

You will provide your iTunes Connect username, password and the location of the .itmsp folder.

The -t DAV -t Signiant -k 100000 commands are used to specify the delivery method used to upload the file to iTunes Connect. The -v eXtreme command is used to get any detailed logs or stack traces if an exception is encountered.

Photo by Will Porada on Unsplash

The final result

When you finally put all your commands together, your script should look like this:

This method of automated upload has saved our teams hundreds of hours. Releasing updates into the Appstore is much quicker and we get to spend more time thinking about and doing the interesting development we signed up for!

References

Apple introductory document for iTMSTransporter: https://itunespartner.apple.com/en/tv/faq/Transporter_Getting%20Set%20Up

Apple documentation on options that can be used with the iTMSTransporter command: https://help.apple.com/itc/transporteruserguide/#/apdAa073cb45

Apple documentation on the options for the iTMSTransporter upload command: https://help.apple.com/itc/transporteruserguide/#/apdATD1E1288-D1E1A1303-D1E1288A1126

An article that gives examples on how to use the iTMSTransporter lookup and update metadata commands and the verify and upload commands: http://www.cyrilchandelier.com/having-fun-with-itmstransporter

Another useful article that gives the background of iTMSTransporter and how to use the iTMSTransporter commands: https://medium.com/@tonyspin/uploading-ios-in-app-purchase-downloadable-content-727e0d2c0531

--

--