devsugar: A better way to share ad-hoc builds

Sponsored Links

devsugar: A better way to share ad-hoc builds

Hey, Dave Howell. This post is for you. Dave's company Avatron is in the midst of a beta program for its newest application, Air Display. Steve Sande took a first look at Air Display not too long ago, and I've been messing with it too. The thing is this: Avatron is still sending out zipped application files and separate mobile provisions. As I told Dave, there's a much easier and better way to do Ad Hoc under the 3.2 and later Gold Master iPhone OS SDK.

Ad Hoc provides a way to distribute signed, secure applications outside of App Store channels. With Ad Hoc, you can send your applications to up to 100 registered devices and run those applications using a special kind of mobile provision that allows the applications to execute under the iPhone's FairPlay restrictions. Ad Hoc distribution is especially useful for beta testing and for submitting review applications to news sites and magazines.
Register devices at Apple's Provisioning Portal

With Ad Hoc distribution, you can register up to 100 iPhone and/or iPod touch units and create special "mobile provision" files that allow your apps to run on those units. To register, users must send you their unique device identifiers (UDIDs). They can grab their ids from iTunes or from the device itself.

In iTunes, open the device Summary tab, tap Serial Number (it changes to "Identifier"), and press Command-C (Mac) or Control-C (Windows). They can then paste the UDID into an email. From the device, they can download Ad Hoc Helper, tap the icon, and then address the pre-filled email to you.

Once you've registered devices and created the provision, download that provision and drag it into Xcode. You need to compile your application with it, preferably using an Ad Hoc configuration. Whenever you need to add new devices, just modify your provision and download it again. This won't affect any existing users and will allow you to add new users as needed.

Create an Ad Hoc Configuration and adding an entitlement

To create a new configuration, double-click on Groups & Files > Project File (it has the blue icon with the white A on it) > Configurations. Duplicate your Release configuration and rename it Ad Hoc.

Next, add a new entitlement to that configuration. Choose File > New File > Code Signing > Entitlements. Click Next. Enter dist.plist. (This is a completely arbitrary name.) Click Finish. The newly created entitlement property list file appears in the Products folder. Double-click it to open and uncheck get-task-allow. That is, set it to a Boolean value of FALSE.

After setting up your entitlement, you need to add it to your target settings. Select your Distribution configuration from the project window. Double-click the project target (Targets > Your Project Name). The Target Info window opens. In the Build tab, set your configuration to Ad Hoc again if it is not already set. Double click Code Signing Entitlements. Add the file name dist.plist to the Code Signing Entitlement and click OK.

Building and sharing the app

Now you're ready to build your application. Make sure your Code Signing Identity is set to the Ad Hoc version of iPhone Distribution by selecting your ad-hoc mobile provision from the Any iPhone OS Device pop-up. Select Build > Clean (Command-Shift-K, this is optional) and then Build > Build and Archive. Your application will build and the Xcode Organizer window will open.

The newly archived application will appear in iPhone Development > Archived Applications in the Organizer. Locate the build (it is listed by application name and by build time and date) and select it. In the bottom pane, select Sharing > Share Application. A "Share Archived Application" pop-down dialog appears.

Choose your Ad Hoc provision as your signing Identity. Once chosen, your iPhone distribution identity will appear in the pop-up. It will not say "Ad Hoc," but you can confirm the identity by reopening the pop-up at any time. Next, click E-Mail. Apple's Mail application opens (completely ignoring any default Mail application you may have set) with a New Message window populated with a ready-built ipa file. Address the message, add a subject, and send it on its way to beta testers or reviewers.

Sharing via ipa couldn't be easier. Ipa files or "iPhone archive" files can just be dropped into iTunes and contain all the material your recipients need, including application files and provisions.

If you're concerned whether the ipa file is properly created, go ahead and repeat the Share Application step but save the file to the desktop instead of opening it in Mail. Then unzip the ipa file and look into the Payload folder that is extracted. Inside, you'll find an application bundle, and inside there, you'll discover the embedded provision file. Perform a simple grep or load the file in TextEdit to confirm that the proper UDIDs have been included in the provision.

Once you reassure yourself that the ipa file is valid, you'll find that this is a much easier way to build and share your ad hoc applications than sending out multiple files and zip archives.
All products recommended by Engadget are selected by our editorial team, independent of our parent company. Some of our stories include affiliate links. If you buy something through one of these links, we may earn an affiliate commission. All prices are correct at the time of publishing.