A blog post

EZ OTA

Posted on the 07 January, 2011 at 12:35 am Written by admin in Blog, Development

To use another FLA (Four Letter Acronym), it’s a big PITA to sync your iOS device via USB to iTunes. When you’re looking for quick feedback on the behavior, usability, or performance of an ad hoc development build, the painful USB syncing process is a barrier that prospective testers have to cross before they can test the new code. At the very least, that barrier costs you and them time, and it maybe even costs you any chance of them installing the build at all. But there’s an easier way — distribute the build wirelessly, direct to the target iOS device, right from your own Mac.

Here’s how. These first steps are really just to make sure the Apache installation on your Mac is correctly configured to serve OTA builds. They will only have to be done once.

First, make sure that Web Sharing is enabled (Settings->Sharing).

Next, bring up a Terminal window and enter the following command at the prompt:
sudo emacs /private/etc/apache2/mime.types

You will be asked for your administrator password. After you enter it, you’ll see an emacs buffer holding a text file with a comment on the first line that says, amusingly enough, “This is a comment. I love comments. “.

Ctrl-s to search, and enter “octet” (no quotes), which should bring you to a line that looks like the following:
application/octet-stream bin dms lha lzh so iso dmg pkg bpk elc scpt dmgpart
Go to the end of the line and add “ipa” to the list of types recognized:
application/octet-stream bin dms lha lzh so iso dmg pkg bpk elc scpt dmgpart ipa

Ctrl-s again, and this time search for “text/xml”. Add “plist” to the text/xml item:
text/xml plist

Ctrl-s, ctrl-x to save the file.

Restart Apache so that it recognizes the new MIME types:
sudo /usr/sbin/apachectl restart

Whew, we’re done with that — on to XCode! These next steps will need to be done for every build you would like to distribute. Don’t worry, it looks longer than it really is. I’ll assume you’re already familiar with generating ad hoc distribution builds. After your code is ready to go, create an ad hoc distribution build by using the Build and Archive item under XCode’s Build menu.

Next, go to Window->Organizer to view the Organizer window. At the bottom left, you’ll see a section called Archived Applications where you should find the name and icon of the application that you just created. Click on the icon, then select the specific build from the list on the right pane of the window.

At the top of the right side is a button titled Share. Click it, then select the Distribute for Enterprise item. A modal pane will slide down. You really only need to fill out the Title and URL items. Title is easy — it’s the name of your application, e.g., AccelaRuler. Create a URL using the Bonjour name of your computer (check Settings->Sharing->Computer Name) and your application ipa. For example, my Bonjour name is FilthyLucre.local, and I am building accelaruler.ipa, so my URL is going to be http://filthylucre.local./accelaruler.ipa

Click OK, and when prompted for a name, use the base name you used for the ipa (e.g., accelaruler). Save the items to /Library/WebServer/Documents. If you check there after following these steps, you should see two files, an ipa and a plist with the base name.

Here’s the magic URL that your ad hoc testers will need to enter into Safari on their devices in order to download the build:
itms-services://?action=download-manifest&url=http://COMPUTER NAME/APP NAME.plist

And here it is with the example info we’re using:
itms-services://?action=download-manifest&
    url=http://filthylucre.local./AccelaRuler.plist

To make things really easy, you can embed this as a link in an HTML document and just point your users at that referring page:

<a href=”itms-services://?action=download-manifest&url=http://filthylucre.local./AccelaRuler.plist”>Install AccelaRuler</a>

Note that this exact process will only work for users on your local network. Similar steps also work for externally visible web sites — just replace your computer name with the URL to the externally visible location, and then save or move the ipa and plist files to that location.

-Geoff

reply