With my recent upgrade to Xcode 4 I have run into some problems archiving my apps and creating ad hoc builds to distribute to clients. I think I finally have a handle on all the steps and thought I would share them here for your reference and mine.
Before we get into creating an ad hoc build I want to put in a word on distributing ad hoc builds in general. It used to be that the way to do this was to build your ad hoc app signed against your ad hoc distribution provisioning profile and then you would share both the .app file and the .mobileprovision file. The user would then have to drag the .mobileprovision file into the left bar in iTunes and do the same with the .app file. A much better way is to distribute an IPA file signed with the ad hoc distribution provisioning profile so that the user just has to double click the IPA file to install in iTunes.
To create an IPA file used to take a bit of work, but for some time now there has been a very handy way to do this directly in Xcode through the Archive (previously Build & Archive) option. When you Archive an app it puts the Archive into your Organizer where you can then choose to share the app as an IPA file and select a provisioning profile to sign it with. I have a wild card app ID that I use for all my development work and also to create the ad hoc distribution provisioning profile. I always give the distribution profile a generic name so that I can use it no matter who I happen to be working for.
Anyway, that is the big picture. Here are the details:
Note I am assuming you have already created and downloaded a distribution provisioning profile that includes the UDIDs of the people’s devices you are distributing to.
Make sure you have set an icon file to use
If you don’t have an app icon you can’t create an ad hoc distribution, so make sure you add one to your project and set its name in your Info.plist.
“Previous to Xcode 4.x, it was required that the developer create a Code Signing Entitlements file in the Application Bundle for Ad Hoc testing, that defines the entitlement “get-task-allow” with a value of “false” (un-checked). However with Xcode 4 that is no longer required so long as the application is shared via deferred signing on the Application Archives panel in Organizer. See the section Using the Build And Archive feature of Xcode for Deferred Code Signing for more information.
Try removing the Code Signing Entitlements configuration from the Project and Target “Build Settings” tabs in Xcode 4, and then try your Ad Hoc build again.”