by Stephen Dewitsky posted on February 25 2011 13:02
So the best kept secret of iPhone OS 4.0 is slowly becoming a well known and most useful process. Wireless Distribution or Over the Air (OTA) Distribution model can be officially referenced via Distributing Enterprise Apps for iOS 4 Devices. This new model removes the overhead of educating a client, or application tester, on the nuances of installing an Ad Hoc Distribution. Provisioning files and application build are bundled together in an .ipa, or iPhone Application Archive, which can be installed on device with or without iTunes. Installing through iTunes is as simple as Drag n Drop, then Sync. Installing OTA is as simple as tapping a link from the web browser.
The setup process, however, is still bestowed on the development team. Checkout the guidelines on Apple's reference page: Distributing Enterprise Apps for iOS 4 Devices, or some nicely packaged tutorials; such as Distribute Ad Hoc Applications Over the Air (OTA). I will relinquish the details of how to accomplish the distribution to the reference guide and focus on what to do when the iPhone OTA distribution does not work.
When attempting to configure the iPhone Wireless Distribution I encountered 3 hurdles on my way to success.
-
Problem: After executing Build and Archive, Organizer does not automatically open
Solution: Make sure your application identifier matches the id linked to your Ad Hoc provision file
This may not be a pertinent step to a successful distribution, but I include here because the behavior of XCode was affected. Each Ad Hoc build is configured to use an Ad Hoc provision file which in turn is linked to an Application Identifier configured in the program portal. These identifiers are usually reverse domain in the form of "com.yourcompany.*". When creating a new XCode project, the default application id is something like "com.yourcompany.${PRODUCT_NAME:rfc1034identifier}". Modify the identifier to match the configuration set in your program portal. After the "Build and Archive" process completes, Organizer should open automatically with your new "Archived Application" listed below.
-
Problem: Download Application link does not work
Solution: Make sure your web server has the correct MIME type set for both .plist and .ipa files
Property List (.plist) and iPhone Application Archive (.ipa) files are served to the iPhone OS devices from your web server. Most web servers, in my case IIS, do not have a MIME type mapping for these file types. When tapping the "download application" link from the HTML page, the page did not initiate a download. The download does not work. It just sat there as if I did not tap at all. In IIS, when the MIME type is not recognized the web server delivers a 404 Page not Found error. The download will not start because the web server thinks the file does not exist, even though we know it does. Since the "download application link" uses the itms-services protocol, the server error does not get relayed to the user interface. Adding the MIME type to the web server's list corrects this problem and can be verified using a web browser. The MIME types for these files are:
.plist - text/xml
.ipa - application/octet-stream
-
Problem: Download Application link still does not work
Solution: Remove any spaces from your absolute URL's file name and web folder structure
I beat my head against the wall on this for a while. It seems logical that a project file or web folder could have spaces in the name since we have a function of URL Encoding, but URL Encoded resources appeared to be the make it or break your head on the wall factor. I had %20 URL Encoded spaces in my web folder hosting the .ipa and .plist files and also had spaces in the file names. Removing the spaces made that "download application link" WORK. I can't explain it nor did I submit a bug report. Could be by design or an oversight. Just check it out for your own sanity.
Having an OTA distribution for iPhone work for you is a great relief on your application workflow. You can now send your testers an email with a link to a web page which holds the capabilities necessary to install your latest version of an iPhone app. As of today, I was successfully able to implement the iPhone OTA distribution using a regular iOS Developer Program account. I bring up this fact because Apple's reference document Distributing Enterprise Apps for iOS 4 Devices clearly states that this model is intended for usage with the iOS Enterprise Program and that the first step in "The process for deploying an in-house apps is: Register for the iOS Developer Enterprise Program with Apple". We all hate to have our heart broken. I just want you to be prepared for a day when the mercy of Apple may not be so kind and the privilege of using wireless distributions with iOS Developer accounts could be revoked without any notice.