Note: If you're using Xcode 4.3 or newer, refer to this tutorial instead.
With the release of Xcode 4, there have been a lot of issues with people being unable to package their applications as IPAs. The new version of Xcode, while making a lot of tasks easier and more streamlined, has caused some confusion due to some internal changes that have not been terribly well documented. In this tutorial we will walk you through setting up your project so you can create an ad hoc IPA suitable for beta distribution. Thanks as well to @nkostelnik for his recent tutorial on this topic.
NOTE: You will need an Apple Developer or Enterprise account to prepare an .IPA to be distributed.
3. Select the newly added Entitlements.plist file and change the Can Be Debugged (get-task-allow) key to NO.
There has been a lot of debate as to whether this key needs to be set to NO as a lot of people have stated that their ad hocs work fine with it set to YES. We aim to stay inline with Apple's documentation for creating ad hocs and their most recent documentation on the Developer Portal states that this value should be NO. We would encourage developers to stay consistent with Apple's workflow should they decide to make internal changes in future OS or IDE releases.
Setup the project for Ad Hoc Distribution
1. In the left panel, select your project
2. Under the PROJECT section, select your project to open up the project settings
3. Under configurations, click the + button and select "Duplicate "Release" Configuration". Name the new configuration "Ad Hoc"
4. Under the TARGETS section, select your application target
5. Go to Build Settings and ensure the "All" option is selected
6. Under "Code Signing" select the "Code Signing Entitlements" key and click the expand arrow to reveal the per-configuration options
7. In the "Ad Hoc" configuration, enter Entitlements.plist. If you named your Entitlements file something else, enter than name instead.
Configure Archive Scheme
1. In the scheme dropdown in the top-right of the IDE, select iOS Device and click Edit Scheme
2. In the scheme editor window, select the "Archive" scheme in the left and change the Build Configuration setting to "Ad Hoc"
Archiving and Packaging
1. Select the iOS Device option in the Schemes drop-down
2. Under the Product menu, select Archive
3. In the Organizer window that appears (go to Window -> Organizer if it does not), select Archives at the top, your application on the left, and the most recent archive at the bottom, and click Share
4. Select iOS App Store Package (.ipa) in Contents and the appropriate Distribution code signing identity in the drop-down
- Click Next and enter the name of your IPA to save it
- Upload your application to TestFlight
Setup build settings for 3rd party libraries
If you are migrating from Xcode 3, or are using cross-project referenced to build 3rd party libraries, and do not get the option to package your app as an IPA when sharing, you may need to modify some of their build settings. This is the biggest holdup for a lot of developers as this was not needed in Xcode 3. This tutorial assumes you are using cross-project references to build your libraries. In the project settings for each 3rd party project, ensure that the Skip Install value is set to YES, otherwise when you attempt to create an IPA you will only get the option to create an .xcarchive file.
If you are migrating from Xcode3, most of the build configurations, schemes, etc. will migrate as well.