Monthly Archives: August 2016

adhoc OTA iOS app distribution

Update: This post is no longer valid since Dropbox discontinued downloads in the manner mentioned in this post.

Credits

  1. http://stackoverflow.com/questions/26042508/over-the-air-ota-ios-ipa-file-distribution-for-public
  2. http://stackoverflow.com/questions/20276907/enterprise-app-deployment-doesnt-work-on-ios-7-1

I am an iOS developer and often I have to distribute apps to our testers. I have been using Hockey for this until recently but with iOS10 beta release, the Hockey app broke and I wasn’t able to distribute my app. Then I remembered the old fashion technique of OTA (over-the-air) distribution that old time iOS developers must be familiar with. OTA distribution was used up until TestFlight and Hockey became the de-facto app distribution channels. This post tries to explain it.

Before we proceed let’s set the context clearly. This is not a post concerning Enterprise distribution. This post is specific to adhoc distribution of iOS app to devices added to your Apple Developer Account. To rephrase; If you had the device ids of your test devices, how do you distribute your app to them in an easy way. You do it using adhoc OTA distribution. Lets look at how this is done in steps.

Creating an adhoc distribution build

  1. Get the device ids of your test devices and add them to your Apple developer account.
  2. Create an adhoc distribution provisioning profile for your app id and add the test devices to it.
  3. Download the adhoc provisioning profile into Xcode and build your app as an archive by codesigning it with this provisioning profile.
  4. Select the archive in Xcode > Organizer window and choose Export.
  5. From the choices, choose “Save for adhoc distribution” option.
  6. A .ipa file will be generated. This is your adhoc distribution build. Pause a second and rejoice at your progress.

Distributing the adhoc build

The distribution process requires you to upload the .ipa file and an additional .plist file to a web server and expose a public html webpage to your testers. This webpage will contain the download link with a particular url-scheme that iOS devices understand. The link points to the .plist file which internally contains the download path to the .ipa file. There are other conditions around your web server like it should expose the .ipa and .plist files via https and the SSL certificate for https should be from a valid signing authority not a self signed one.

Don’t get anxious. It’s easier than it looks as you are about to discover now.

  1. You already have the .ipa file.
  2. For the .plist file you can download this sample that I copied from this StackOverflow question and do the necessary edits as mentioned in Step 5 below.
  3. I know what you are thinking, “How do I upload the .ipa and .plist file to a server? I don’t have any web server. How do I create the html web page with the download link?”. Worry not, let’s simplify all this by using Dropbox. That’s right. We will use Dropbox for hosting everything; the .ipa file, the .plist file and the html web page file. Using Dropbox also takes care of the https requirement as it is already https.
  4. Upload the .ipa file to Dropbox and copy it’s link. Your link should look something like this https://www.dropbox.com/s/lbine4ik0l0jgv3/xyz.ipa?dl=0. Now here is the critical part. Change “www.dropbox.com” to “dl.dropboxusercontent.com” in the copied link and remove the “?dl=0” part. Finally, your .ipa file link should look like https://dl.dropboxusercontent.com/s/lbine4ik0l0jgv3/xyz.ipa.
  5. Edit the .plist file to point to the above .ipa file link. Note that you don’t need to provide valid values for all the keys present in the .plist file. Only certain values should be correctly filled in and looking at it you would know which ones. Don’t remove any keys though. Let them be present with whatever invalid values they have.
  6. Your .plist file should be renamed to be exactly the same as your .ipa file created above. If your app is xyz.ipa, your .plist file should be xyz.plist.
  7. Your .plist is now ready to go on Dropbox. Upload it and copy it’s link. Your link should look something like this https://www.dropbox.com/s/lbine4ik0l0jgv3/xyz.plist?dl=0. Again change “www.dropbox.com” to “dl.dropboxusercontent.com” in the copied link and remove the “?dl=0” part. Finally, your .plist file link should look like https://dl.dropboxusercontent.com/s/lbine4ik0l0jgv3/xyz.plist.
  8. Now create an html file with this content. Note that it contains the special url-scheme that we mentioned earlier and it also has the modified .plist file link we obtained in Step7 above.
  9. Your html file is now ready to go on Dropbox. Upload it and copy it’s link. Your link should look something like this https://www.dropbox.com/s/lbine4ik0l0jgv3/download.html?dl=0. Again change “www.dropbox.com” to “dl.dropboxusercontent.com” in the copied link and remove the “?dl=0” part. Finally, your html file link should look like https://dl.dropboxusercontent.com/s/lbine4ik0l0jgv3/download.html.
  10. 🎪That’s it. Share this html link with your testers via email and ask them to view the email on their test devices.  When they click the link, they will be redirected to Safari which will open your html page. Once they click “Download”, they will be prompted to install the app.

Seems like an long process but it’s not. Plus it’s a nice alternative to have apart from Hockey, Testflight for easy distribution to testers. Hope this helps someone.