Distribute Ad Hoc Applications Over the Air (OTA)

Mon, Feb 21

Note: The information below is specific to Xcode 3.x (Xcode 4 was not available when the post was written).

If you’ve been through the distribution process of an Ad Hoc application, you can appreciate the challenges of getting a build installed on someone’s device. From the differences of working with users on Windows versus Mac machines, to explaining how to import an Ad Hoc provisioning file and the associated build into iTunes, this process is anything but a walk in the park.

In this post I’ll take you through the steps of deploying Ad Hoc builds over-the-air, where users simply point the Safari web-browser (on their iPhone) to a link and tap to install the provisioning file and associated application.

Provisioning Profile

To begin, create a provisioning profile like you would for any other Ad Hoc build. In the image below you’ll notice I created a profile named AdHocOTAProfile and associated this with the app id AdHocOTA.

Once the profile is created, download onto your location machine and drag/drop the file onto the Xcode icon, this will install the provisioning file into the following folder: ~/Library/MobileDevice/Provisioning Profiles. The image below is a screenshot of the profile path on my machine – notice the provisioning file name is no longer the nice readable name that was written to your file system when you downloaded the file, this is to be expected.

From within Xcode, you can now associate this provisioning profile with your build. In the Target settings, select the Build tab, in the Code Signing section choose the new Provisioning Profile you created:

Xcode Build and Archive

Once you have a working project within Xcode (with the Code Signing identity set as mentioned above), make sure that you set the build type to Device.

From the Build menu in Xcode, choose Build and Archive (if this option is not highlighted, make sure you’ve selected Device in the build settings.

Once the build is complete, the Organizer window will appear – make sure the Archived Applications section is selected on the left panel.

In the figure above, I’ve updated the Name of the app to AdHoc OTA Test, this is optional, as well as any comments you would like to include.

Click on the Share button, and a new dialog will appear similar to that shown below:

From the Identity dropdown, select the Provisioning Profile created earlier:

Now choose Distribute for Enterprise – fill in the URL to the location where you plan to host the application. Note that you must include the fullpath to the application, including the name of the .ipa file that you plan to use:

At this point, don’t worry about the image files, I believe those are applicable only if you are doing an OTA deployment through an Enterprise developer account (internal app distribution for corporations). Update: Seems there may be a little more to how the images are used beyond Enterprise deployments, see the comments section for more information.

Once you select Ok, you will be prompted for a filename to save the build, verify that you use the same name as you specified in the URL:

At this point ipa and plist files will be created for you, the provisioning file will be embedded within the ipa.

OTA HTML File

With the build complete, we know need to create a very simple webpage that will allow users to find the application on a web-server.

The html below is as about as bare-bones as we can get, it’s nothing more than a link to the file, with a specific href for itms-services which Safari will recognize and initiate the download/install process when clicked.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head> 
  <title>OTA Test App</title> 
</head> 
<body>
  <ul>
    <li><a href="itms-services://?action=download-manifest&url=http://3SixtySoftware.com/OTAtest/AdHocOTATest.plist"> Tap Here to Install the Application</a>
  </li> 
  </ul> 
</body> </html>

Important: – Replace the path shown above with the path to where you will upload the ipa and plist files that Xcode created.

Save the html file with the extension .html

Upload To Web-Server

We’re getting close – at this point we are ready to upload the ipa, plist and html files. The figure below shows the directory listing on the web-server where I uploaded the files:

Install the iPhone Application OTA

To download the application via OTA, start your web-browser and point it to the link where the html file lives. Once loaded you should see a screen similar to the figure below:

Tap on the link and a dialog will appear asking if you would like to install the Ad Hoc application:

If all works as expected, at this point you can send a link to the html file to anyone you included in the provisioning file and they can install the application OTA.

57 comments

I’ve been using TestFlight to automate some of the process. Works great

by Jnpdx on Feb 21, 2011. #

Me too. TestFlight has made it possible for my non-tech-savvy friends-with-iPhones to participate in my beta…

by Bill on May 12, 2011. #

There is also Diawi which is a free online tool to deploy your development iOS applications directly to your devices using iOS 4 wireless app distribution mode.

You just need to upload your .ipa to get an install url that will work directly on your iOS devices :)

by Arthur on Feb 21, 2011. #

Hi John,

The image file is useful because it is displayed by itunes in the list of apps on your phone. If someone installs ota, and then syncs with iTunes, the icon will be missing.

by Seth Raphael on Feb 21, 2011. #

Thanks!

by Suresh Kumar on Feb 21, 2011. #

Don’t forget to generate the entitlements file to proceed adHoc distribution.

If you don’t, the app download but fail during the install :)

by lbstephane on Feb 23, 2011. #

What is the entitlement file and how is it generated.

by Jude on Dec 10, 2011. #

Jude, I would recommend you look at the Apple docs related to deployment, the entitlement file and how to create is described in more detail.

by John Muchow on Dec 11, 2011. #

Just used this to get my app out today to the staff.

Many thanks.

by AndyJ on Mar 15, 2011. #

Does this method require iOS Enterprise Program or iOS Developer Program – Individual is enough?

And if iOS Developer Program – Individual is enough, is there any easy way to easy update deployed apps?

by Diabl0 on Mar 18, 2011. #

This deployment process can be used for the Individual Developer, Enterprise is not required.

by John Muchow on Mar 18, 2011. #

I believe, if the bundleid and product name haven’t changed, and the bundle version and the CFBundleVersion short numbers are higher than the ones that are deployed, its should update the deployed apps. (I am not 100% sure about it though)

by Nitin on May 5, 2011. #

Anybody else find that this no longer works on ipad version 4.3 of IOS? Worked on 4.2.

by Jeremy on Mar 23, 2011. #

Yep, the icon would suddenly disappear after install. It’ll pop up again as soon as you restart your device. I’m trying to find a solution for this.

by alex n on Mar 25, 2011. #

Hi Alex, did you manage to find a solution for the icon disappearing on ios 4.3?

by marco on Apr 7, 2011. #

Actually, I did.

It turns out to be that the bundle-identifier in my manifest.plist file did not match the adhoc provisioning profile identifier. This property has to match the APP ID in the provisioning portal that you created the profile with.

i.e. My APP ID = com.TheApp.*

WRONG:
bundle-identifier
com.SomeOtherName.Whatever
CORRECT:
bundle-identifier
com.TheApp.TheAppName

Also, make sure that you replace ‘TheAppName’ with the same value as ‘Product Name’ in your project + target settings.

by alex n on Apr 7, 2011. #

@alex n, thanks SO much for commenting that the properties need to line up (and they didn’t before). This saved me today.

by Daniel Rosenstark (yar) on May 2, 2011. #

@Daniel

Glad my problems lent you a hand!

by Alex Nguyen on May 2, 2011. #

Hi,
I tried this tutorial, but i am not able to share using “Distribution for Enterprise.”? Does anyone tried this.

I am preparing iPad application with iOS 4.2.

Thanks in advance.

by developer on Apr 6, 2011. #

Hmmm, are you using Xcode 4 (I haven’t tried this with this release version 4)?

by John Muchow on Apr 6, 2011. #

Great article. I’ll try this on my next ad hoc build. I can’t tell you the number of GotoMeetings I’ve had to do to get ad hoc builds installed on a client’s phone/ipad.

by Dave Gruen on Mar 24, 2011. #

I used it this morning and it worked like a champ. Just a reminder that if you are using a Windows server you have to set the MIME types on the server. By default IIS will block a .plist and an .ipa file.

This is a going to save a ton of time. Great article.

by Dave Gruen on Apr 7, 2011. #

@Dave Gruen – Thanks SO much for this tip. I’ve been racking my brain over this all morning. I created the file association on the server, and matched the MIME exactly in IIS, and it works like a charm. Thank goodness for forums. Take care :)

by Jackie on Feb 7, 2012. #

Just for reference, and save you another Googling :)

.ipa – application/octet-stream
.plist – application/xml

by Paul Derbs on Aug 3, 2012. #

I’m trying to follow the steps but when clicking on “Distribution for Enterprise.” the dialogs just disappears and no form is displayed…
I’m using XCode 3.2.5, should I upgrade to 4 ?
Before selecting the “Distribution for Enterprise.” option on the right I see and activity indicator with the legend “Getting identity information…” and never stops till I press the options.
After pressing the option another legend is displayed but to fast to be able to read it… :S
I have the certificates and the provisioning profile as always do for adhoc distributions.
Any idea?

by Federico on Apr 19, 2011. #

Finally it worked with XCode 4

by Federico on May 6, 2011. #

I think this fix had to do with the setting to YES of “Skip Install” Deployment property in the included static library by the project, but not sure… https://devforums.apple.com/thread/86137

by Federico on May 13, 2011. #

Thanks for great tutorial. I have a question, how many device can be installed the application distribute by OTA?

by Tue Nguyen on May 27, 2011. #

For Adhoc I assume the limit is 100 (as with the traditional approach), I don’t know if there is a limit for Enterprise accounts

by John Muchow on May 27, 2011. #

Hi All,

On choosing Distribute for Enterprise window to enter the URL does not appear..

What causes this issue?

Thanks
Merlyn

by merlyn on Jun 21, 2011. #

I had the same problem. After trying with XCode 4, then tried back again with XCode 3 and it worked, maybe XCode 4 did modify some setting in the project related with the problem.
More info at my May 13th, 2011 at 8:41 pm comment.
Hope it helps!

by Federico on Jun 23, 2011. #

Same issue here. I downloaded and installed XCode 4. It worked with XCode 4, and now also works for XCode 3.

by asrar on Jun 28, 2011. #

Hey,

Managed to solve the error.

Added the entry value “$(SDKROOT)/ResourceRules.plist” for Code signing resource rule path.

I came to this conclusion by creating the *.ipa for the application using command line. The error indicated that Resource file could not be read.

command Used:
/usr/bin/xcrun -sdk iphoneos PackageApplication -v “${PROJECT_BUILDDIR}/${APPLICATION_NAME}.app” -o “${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa” –sign “${DEVELOPPER_NAME}” –embed “${PROVISONNING_PROFILE}”

Thanks
Merlyn

by merlyn on Jun 23, 2011. #

Thanks for this. I’ve been trying to get my office colleagues to help out with testing and user experience and it was a major pain in the butt to have to get their phone and manually install it.

by Bradley Gibby on Aug 11, 2011. #

Great article. It works very well.

Thanks,
Juliana

by Juliana Chahoud on Aug 17, 2011. #

Great article….It helped me a lot

Thanks
Sravan Alluri

by sravan on Aug 18, 2011. #

Thanks to “Dave Gruen” for telling to set mime types…it helped me a lot
Thanks
Sravan Alluri

by sravan on Aug 18, 2011. #

Great article. I have some questions.

Is that means I can distribute and sell my app to users using this OTA method in my web site instead of App Store?

Besides that, does this work for non-jailbreak iPhone?

Thanks.
Rachel

by Rachel on Aug 27, 2011. #

This is only an alternative means to distribute Ad Hoc builds, it is not a substitute for the App store. There are the same limits as before, up to 100 devices.

by John Muchow on Aug 29, 2011. #

One of my colleague install myApp ad-hoc distribution wireless successfully,but he didn’t register his device UDID in my ad-hoc.mobileporvision,I am very curious about that yesterday,how could that happend?

But today I understand,because his iPod Touch has been jailbeaked!!!

even so, Ad Hoc Distribution OTA is very simple and convenient for both jailbreaked or not jailbreaked device to test your app.

And now I understand the ad-hoc distribution is limit to 100 devices. Thank you!

by godlaugh on Sep 3, 2011. #

If this really works you are my hero!

by Neil Bolton on Aug 30, 2011. #

Hi,

I have found one of the wierded issue in my programming career using this distribution method.

I can create and sign archive, upload to server, download and install app successfully. But when I run the application first time, it doesnot support rotation at all. Everything works fine in portrait mode though.
If I kill the application and re-run the application, it works fine. Also if I re-install the application without un-installing, it works fine.

Any idea why?

Your help will be very much appriciated.

Thanks
Nitin

by Nitin on Sep 2, 2011. #

This seems more like a problem with the application than the distribution method. You may also want to try other approaches to getting the app on a device to see if the same issues are present. For example, load the app via Xcode and load using “traditional” adhoc distribution with iTunes.

by John Muchow on Sep 2, 2011. #

Thanks for your quick reply.

With Xcode, it works great without any issue.

The surprising thing is – if I install again using same archive, it works fine. But on first attempt – no rotation support.

Can you think of any steps I am missing?

Nitin

by Nitin on Sep 2, 2011. #

Worked for me, thanks.

by Sumedh on Oct 11, 2011. #

How to install any application more than 100 ipad using ad hoc?

I watched this kind of applications which is installed on any ipad through URL, Please let me know if you have any solution?

Regard
Pravin

by Pravin on Oct 31, 2011. #

Its is awesome.
Tanks Keep doing the great work Buddy…………………..
Thanks once again………………

by Krish on Nov 4, 2011. #

Bummer its not working for me. At the point it gets to ‘installing’ it gives up and says it cannot install the app at this time. The app installs fine when the device is directly connected to Xcode and signed using a traditional adhoc distribution provision.

I noticed you create and sign with a regular developer provision rather than an adhoc distribution one. Was that an oversight in the article or does that really work??

by Doug on Nov 28, 2011. #

@Doug — I’m running into the same issue as well. Were you able to resolve it?

by Nam on Dec 2, 2011. #

Yes. Amazingly yes. So with iOS 5 and Xcode 4.2 this all works.

First the preamble:
1. in organizer I removed my ad hoc profile.
2. Then in the iOS portal I made sure all the devices I wanted were checked and re-downloaded the profile.
3. Then I dragged and dropped the newly downloaded profile into the organizer window and saw that it was happy with it.

Now what I think made it work:
1. Bring up your project’s info section in Xcode where it shows your deployment target and configurations. Delete your ad hoc configuration (I had one and I assume you do to as I think this is the problem).
2. Click on the “+” and select “Duplicate Release” and call it your ad-hoc guy.
3. Move over to build settings and down where you pick code signing locate your newly created build config.
4. Pick ‘iPhone distribution” the generic one.
5. Edit your Xcode scheme and click on the archive guy. Change his build config to be your ad hoc config.

And the ending:
1. Archive.
2. In organizer, share for enterprise. I left the signing alone (generic iPhone distribution, did not locate the specific ad hoc guy).

I have made several beta releases and my beta testers have it work. Its flat out awesome to do it this way. Why don’t they make a bigger deal about this on the dev portal?

Hey, post back if it helped! Id like to know that was my problem.

by Doug on Dec 2, 2011. #

Worked!

by freudianstrip on Dec 15, 2011. #

I got it.
Skip Install set to YES for dependencies, here is the link: http://stackoverflow.com/questions/5265292/xcode-4-create-ipa-file-instead-of-xcarchive/9238070#9238070
And then went to Coreplot-CocoaTouch, which is dependence of my project targets. Then went to Coreplot-CocoaTouch Targets. In Targets opened Build Phases. Then opened Copy Headers. There I had some of headers in Public, some in Private and some in Project. Moved ALL of them to Project.
Of course, in Build Settings of Coreplot-CocoaTouch Targets checked that Skip Install was set to YES in Deployment options.
And this time Archive made an archive that could be signed and .ipa produced.

by bg on Feb 11, 2012. #

Hi,

I’m following your instructions but when I click on “install” on my device I get the error message:

“AppOTA” could not be downloaded at this time.

I don’t know if I’m missing something. Some step.

You don’t mention distribution profile, just developer (I’m a newbie so nothing is obvious to me yet). I understand from what I read that since I have xCode 4.3 and iOS 5 app I don’t need that Entitlement file. I can’t find where to created it anyway.

I don’t have any third party library so I’m not setting the skip install value.

You also don’t mention anything about editing the scheme and change “Release” to “Ad Hoc”. I’ve seen that in other instructions so I’m not sure if I should do that.

I’m totally lost here. Any help would be greatly appreciated.

Thanks in advanced,

Juan.

by Juan Gonzalez on Mar 1, 2012. #

right, you can set up the scheme for archiving, it is a copy of your release scheme, basically you could use release instead, just make sure you use correct developers profile – the one that you create for OTA distributions!

So were you able do produce signed .ipa package from your archive?
If you did then check the names and url you used while saving for Enterprise Distribution.

B

by bg on Mar 21, 2012. #

Has anyone managed to use Apple Configurator for enterptise apps?
Everytime I try I keep getting a message “Can’t install” “Invalid app identifier”

It works fine instead if I install apps downloaded from ITunes

I read somewhere it needs to add a developer provisioning profile to the settings, but did not find info on how to do this.

Any help will be greatly appreciated.

by marco on Mar 14, 2012. #

Remarkable issues here. I’m very satisfied to see your post. Thank you so much.

by tv wall mounting in Leeds on Apr 2, 2012. #

thank you very much for the post, it works perfectly well.

by steve on Aug 20, 2012. #