New FastLane Plugin to Upload iOS Binary With altool
Learn about altool, a plugin for FastLane which allows you to upload iOS binary to iTunes Connect for continuous deployment, and how to set up and use it.
Join the DZone community and get the full member experience.
Join For Free
apple doesn't want us to enable continuous deployment for whatever reason. there is no api to deal with itunes connect 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 processes to upload the build to itunes connect. in the
previous blog
post, we saw
five ways
to upload ios binaries to itunes connect. in this post, we will go through the 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 the itmstransporter tool to upload the binaries and dealing with itunes connect, which is a tricky and lengthy approach. there was an issue on github to discuss the use of altool over itmstransporter but the author decided to use itmstransporter to deliver tool.
altool
is a command line interface for the application loader and seems slicker than itmstransporter. 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 was no way to use this tool, so i thought it would be easy to write a plugin so that we can upload binaries to itunes connect.
how to use the altool plugin
using the altool plugin is as easy as using other plugins. to get started, add it to your project by running:
fastlane add_plugin altool
the only pre-requisite of this plugin is you have to have fastlane setup, this plugin has a configurable apple id and password but you probably don't want to code those values in the configuration. you need to have fastlane set up with a
fastlane_user
and
fastlane_password
environmental variable setup. fastlane will ask when you run
fastlane init
, but if not, you have to set these variables.
you can set that easily for bash shell:
$ export fastlane_user="your_apple_id@yourcompany.com";
$ export fastlane_password="your_super_xecret_password";
you can do the same for your choice of the shell if you aren't using bash. this plugin can be used for uploading a generated
ipa
file using gym to itunes connect.
once installed, we can easily configure the plugin using the following configuration parameters:
altool(
altool_username: env["fastlane_user"],
altool_password: env["fastlane_password"],
altool_app_type: "ios",
altool_ipa_path: "./build/your-ipa.ipa",
altool_output_format: "xml",
)
you can configure this once you have created an ios binary or ipa file using gym.
a little bit about security
in the above configuration, we have used environmental variables for secure configuration. it's up to you how you want to use those credentials securely. when the altool plugin runs, it might print the username and password to the console commands, pipe the output to
/dev/null
or use a similar approach so that fastlane doesn't print the command to console. select the right way to secure your details.
example project
there is an example project called altool-demo available on github which has its own readme. feel free to check out the project and try it yourself. this project uses a dummy file so it fails the validation, but if you got real ipa, then it would be uploaded to itunes connect (hopefully).
this plugin is just a ruby wrapper on apple's command line tool altool ; if that altool works, then this plugin should 100% work. i would like to try this on a real app and see how it performs. try it at your own risk. good luck and happy continuous delivery for ios apps.
Published at DZone with permission of Shashikant Jagtap, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments