Building Your App for Distribution With XCode 4
To prepare your iOS app for distribution on the App Store, you’ll need to create a release build for it. You should already have created your distribution certificate and provisioning profile before starting. (If you haven’t, log into the Developer Portal to create them.)
1. Clean all targets. (Product Menu -> Clean)
2. Create a scheme for release. In the toolbar, select the Project name from the Schemes pull-down:
Then in the schemes window, select the Archive (Release) scheme. Set the Build Configuration to Release, enter an Archive Name for your project (this will show up in the Archives window of the Organizer), and check the “Reveal Archive in Organizer” checkbox.
3. Edit the Build Settings for the Project and the Target(s). (If you are using a third party library (such as cocos2d), you’ll have multiple targets to configure.)
a. Click on the Project’s build settings. There are several settings to configure. Under Architectures, set the Base SDK to “Latest iOS”, and Architectures to both “armv6” and “armv7” (how to add armv6 in Xcode4).
b. Scroll down to the Code Signing section, and be sure your Release build is signed with your distribution certificate:
c. In the Deployment section, Apple recommends setting Skip Install to Yes* for your Release build. You should also set the iOS Deployment Target to the minimum version of iOS you want your app to run on.
Repeat steps 3a-c with the Target. (The Target should have the same configs as the Project, but it’s good to double-check.)
4. Create the release archive. (Product Menu -> Archive.)
You can view the Archive build log by clicking on the Logs tab at the top of the navigator frame. Make sure your app builds all the way to completion, including the Code Signing step at the end.
5. Open the Organizer (Window -> Organizer) and confirm that your newly archived app appears there.
Now you’re ready to submit the app to the app store.
*Troubleshooting: if you archived your app but it doesn’t appear in the Organizer archive, first check the archive log and be sure the build was successful. If it did succeed but still isn’t showing up, you may need to adjust the build settings. Here’s one workaround:
For the “Release” configuration do the following:
- Set “Skip Install” to YES on your project
- Set “Skip Install” to NO on your application target
- Set “Skip Install” to YES on all static library targets that are included
Then try archiving again (Product Menu -> Archive).