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

Huishan
Huishan
Jul 29, 2019 · 4 min read

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!”

Image for post
Image for post
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:

Image for post
Image for post

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

Generate the metadata.xml file

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.

Image for post
Image for post

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

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.

Image for post
Image for post
Photo by Will Porada on Unsplash

The final result

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 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

YNAP Tech

Welcome to our dedicated channel for Everything Technology…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store