Every iOS developer at some point in their life is challenged with a task to distribute their awesome app to a group of loyal beta testers. Apple does not make it easy. The reasons for this are clear. We all care about security and greatly appreciate the fact that iOS platform is much more secure than its main competitor, but it is still a problem that needs to be solved. There are services out there that try to automate the ad-hoc distribution process, but sometimes it is not desirable or even possible to use them. Thus, there is a need to bake an in-house distribution system.
To make the ad-hoc distribution work, one must:
- Upload the IPA file to a place where it can be downloaded
- Generate a special plist xml file, referring to the IPA above. This file must be accessible over https!
- Generate an html file with a special Download link, pointing to the plist file above. This is the page users will see
Throughout this tutorial, we are going to use an application called Dishero as an example. We will host it directly on S3, without spinning up machines or configuring http servers. The result will look similar to this:
We will produce a nice webpage, hosted on S3 that will provide details and a one-click install for our application.
Create an Ad-hoc distribution profile
First of all you will need to create a distribution profiles in iTunes Connect.
Ad-Hoc distribution limits the the ability to install your application only on specific devices that have to be pre-registered. Instruct your beta users to visit http://whatsmyudid.com/ and to follow the instructions there to obtain UDID (Unique Device ID) for their device and send it to you.
Follow the pictures below to create an Ad-Hoc provisioning profile, and add all the devices to it. Download it once ready and install in your local keychain by double-clicking on it.
Create a bucket on S3 and enable web hosting on it
You will also need a dedicated bucket on S3 for this. Make sure you enable Web Hosting on your bucket as shown in the picture below.
Bonus: If you want to have your download page to be at a nice URL (we are using download.dishero.com for this example), you have to do a few tricks:
- Name your bucket accordingly - download.dishero.com
- In your DNS, configure a CNAME record download.dishero.com to point to download.dishero.com.s3.amazonaws.com.
We will need s3cmd to upload the files to S3 and set the right permissions.
Installing it using homebrew is easy:
So is installing it using python’s pip:
…or you can just follow the manual process described on s3cmd website.
Once you have it installed, run it
and enter your AWS credentials when prompted. Credentials will be saved and we won’t need to state them explicitly anymore.
Where the magic happens
The script below does all the heavy lifting. It generates index.html, proper plist file and uploads them along with the IPA itself to S3.
Executing the script requires only a few parameters: an IPA file, a bucket path, a version and a build
The command above will make the download page available at http://download.dishero.com/beta. Alternatively, if DNS is not under your control and you can’t do CNAME tricks to get a proper hostname, you will have to point your users to https://s3-us-west-2.amazonaws.com/bucketname/path/