New Fastlane Plugin to Upload iOS binary with altool

Apple doesn’t want us to enable continuous deployment for whatever reason. There is no API to deal with iTunes Connects and Apple still wants to approve your apps. Apple’s own Continuous Integration server a.k.a Xcode Server doesn’t allow us to upload the IPA files to iTunes Connect. The archive process creates an ipa file but stops there. We still need to rely on Fastlane or manual process to upload the build to iTunes connect. In the previous blog post, we have seen five ways to upload iOS binaries to iTunes Connect. In this post, we will go through Fastlane plugin altool that I wrote to upload the iOS binary to iTunes Connect using altool. You can find the details of the plugin here on Github.

Why I Wrote This Plugin

Fastlane has solved the problem of uploading the iOS binary to iTunes Connect with tools like deliver and pilot so that we can script the interaction with iTunes Connect. However, Fastlane uses iTMSTrasporter tool to upload the binaries and dealing with iTunes Connect which is the tricky and lengthy approach. There was an issue on GitHub to discuss the use of altool over iTMSTransporter but the author decided to use iTMSTrasporter to deliver tool.

An  altool is command line interface for the Application Loader and seems slicker than iTMSTrasporter. We don’t need to install this utility explicitly, it comes up with the latest Xcode. Apple has brief documentation of altool here. With Fastlane, there is no to use this tool so I thought it would be easy to write the plugin so that we can upload binaries to iTunes connects.

How to Use altool Plugin

Using altool plugin as easy as using other plugins. To get started with, add it to your project by running:

The only pre-requisite of this plugin is you have to have Fastlane setup, this plugin has configurable Apple ID and password but you probably don’t want to code that values in the configuration. You need to have Fastlane setup with FASTLANE_USER and FASTLANE_PASSWORD  environmental variable setup. Fastlane will ask it when you run fastlane init  but if not you have to set these variables.

You can set that easily for bash shell

You can do the same for your choice of the shell if you aren’t using bash.This plugin can be used for uploading generated ipa file using Gym to iTunes Connect.

Once installed, we can easily configure the plugin using following configuration parameters

You can configure this once you have created iOS binary or ipa file using Gym.

Little Bit about Security

In above configuration, we have used environmental variables for secure configuration. It’s up to you how you want to use those credentials securely. When altool plugin runs, it might print the username and password to the console commands, pipe the output to  /dev/null or use the similar approach so that Fastlane don’t print command to console. Select the right way to secure your details.

Example Project

There is an example project Altool-Demo available on Github which has its own README. Feel free to check out the project and try it yourself. This project is using the dummy file so it fails the validation but if you got real ipa then it will be uploaded to iTunes Connect (Hopefully)

Conclusion

This plugin is just a Ruby wrapper on Apple’s command line tool altool, if that altool work then this plugin should 100% work. I would like to try this on the real app and see how it performs. Try it at your own risk. Good Luck and Happy Continuous delivery for iOS apps.