OTA Distribution of iOS Apps

Distributing your apps Over-the-air to your testers - Part 1: Doing it Manually

Inspired on this link, I set out to first try and set up an OTA distribution of my files to a handful of devices under my control and this is a step-by-step guide for future reference. Part II: Integrating it in Continuous Build, will take a long time because I don't think I'll be needing that in the next couple months. Meanwhile use the article linked above if you're interested in that.

The main steps to get your app distributed over-the-air are the following (I'm including some basic steps so that this can be used on a completely "clean" computer):
  1. Install Xcode
  2. Sign in for an IOS Developer account
  3. Get a Development Certificate
  4. Register the target devices
  5. Create an App ID
  6. Create and download a provisioning profile
  7. Download and import your development certificates
  8. Set your Release version to be signed
  9. Setup your web server
  10. Prepare your app's Icon
  11. Archive your App
  12. Run the Distribution Wizard
  13. Deploy the generated .IPA
Let's go over each step in more detail.

1) Install Xcode
Yes, I know this is a basic step, but I can take the opportunity to say that this whole procedure was tested under Xcode  4.3.1, installed from the App Store.

2) Sign in for an IOS Developer account
This is required so you can properly sign your apps, even if they are to be used internally or for personal use. You will have to pay the yearly fee because the free account will not give you the required signing certificate and you'll only be able to run your apps in the simulator if you're using the free account.

3) Get a Development Certificate
Logon to IOS Dev Center, go to IOS Provisioning Portal and generate a Development Certificate, if you haven't done so before. Also, don't forget to download and install the WWDR intermediate certificate.

4) Register the target devices
Still on the IOS Dev Center, go to the Devices tab to the left, and add the devices that will be used for testing. You can have up to 100 devices registered at once.

5) Create an App ID
This step is optional for simple Apps as you can use the default * App ID, unless you require Push Notifications, In-App Purchases or Game Center integration. Beware that your App ID Suffix is case sensitive, so 'com.foobar.test' is not the same as 'com.FooBar.Test'! Also, don't forget that the Bundle Identifier (App ID Suffix) is in reverse-domain notation, so the last part of the domain comes first and the app name comes last, as in the examples above.

6) Create and download a provisioning profile
If you want to, create a provisioning profile for a particular application; this can be useful if you want to distribute one particular app only to a given subset of your registered devices; otherwise you can use a single provisioning profile that includes all the devices. Click "Provisioning" on the left of IOS Dev Portal and create a new one if desired or download one if you haven't done so. You can also duplicate an existing one and select which App ID and for which devices your Provisioning Profile can be used.
If you created a new Provisioning Profile, open Xcode -> Organizer -> Provisioning Profiles and click "Refresh" to update the list of Provisioning Profiles from IOS Dev Portal (you can also create them from this page in the Organizer).

7) Download and import your development certificates
Navigate to Certificates on iOS Dev Portal and download your Development Certificate; don't forget to also download the WWDR intermediate certificate. Install the WWDR and your dev certificates by double-clicking them.

8) Set your Release version to be signed
Open your project in Xcode, expand your target and choose your signing certificate in Build Settings -> Code Signing. Try Build and Build for Archiving to see that it all works.

9) Setup your web server
This is really up to you. For your own testing with your devices, a local Web browser as provided by Mac OSX is sufficient; if you want to distribute to other people, you'll have to find a safe place to make your files available. Don't forget two things: - you can never have too much security, and you'll need the full URL for your IPA to use in the Distribution step below and the specially formatted URL, like this:

[Update: beware of using self-signed https: iOS will not recognize the certificate and will not complain either, instead just throwing an incomprehensible message that it was not able to download the application!]

On the above URL, I'm linking to a file that will be generated in the Distribution step below and using my own notebook to deploy for my devices. The first line of the URL is fixed and you'll need to change the second line of the URL to your own web address.

10) Prepare your app's Icon
[Update: unlike what I was led to believe before, I found out that this is optional for ad-hoc delivery, although you may want to use the icon on the html page, so get at least the 57x57 icon ready].
The Distribution step below requires the 512 and 57px size icons, so if you haven't prepared them yet, now will be a good time to do so.

11) Archive your App
Important: select the target to >iOS Device; unless you do so, you'll not be able to Archive your App. You may want to run a Build for Archiving first. (Archive is in the Product Menu).

12) Run the Distribution Wizard
Open the Organizer, click the Archives tab, select the Archive that you just generated and click "Distribute..." ("Share" in previous XCode Releases); select "Save for Enterprise or Ad-Hoc Deployment" and click Next. Confirm the code signing identity [update: it must match the provisioning profile selected above] and click Next again. Select the folder where you want your .IPA generated and click "Save for Enterprise Distribution".

13) Deploy the generated .IPA
Copy the generated .ipa and .plist files and your two images to your web server and either create a simple index.html or supply the link directly in the e-mail. Your web folder should now have 5 files in it: index.html, image-57.png, image-512.png, yourapp.ipa and yourapp.plist (probably with different names!)
As for the contents of the html, it's up to you, but a simple one could be like this:
    <title>NetInfo OTA Distribution Page</title>
    Click <a href="itms-services://?action=download-manifest&url=http://madbookpro.lan/~mad/beta/netinfo/netinfo.plist"><img src="netinfo-57.png" /></a> to install NetInfo

Alternatively just compose a mail with the special crafted link above.
[Update: beware of Outlook when composing the mail! I've discovered that outlook will insist in ruining the itms-services://? by adding a third / ]

Now just browse to that page on a proper iOS device and click the link to download. A confirmation dialog will pop up and the Provisioning Profile and the application will be installed at once. 


NSLog(@"Hello World");

Customary 1st post with an Hello World.

I'm currently half-way through this excellent iOS 5 free course in iTunesU from Stanford University: CS193P: iPad and iPhone App Development (Fall 2011)

Now doing a short break to play around a bit with some network functions (more on that in a couple days).