Note: This checklist is for Xcode 3.2. For building apps in Xcode 4.2, click here.
To prepare your new iPhone app for distribution on the app store, you'll need to create a distribution build for it. You should already have created your distribution certificate and provisioning profile before starting. (If you haven't, log into the Developer Program Portal to create them.)
1. In Xcode, select the app target and do 'get info' (⌘I), then look at the Build tab.
2. Change the configuration to "Release". (Or duplicate the Release config and create a new config called "Distribution").
3. Set the Code Signing Identity to your distribution certificate. Show me
4. Scroll down a bit further and set the iOS Deployment Target to whatever minimum version of iOS you want to build for. Show me (Be sure you've tested your app for this version. Some newer features of the iOS SDK aren't compatible with older versions of iOS.)
5. Close the info view. In the Xcode toolbar, change the target to "Device", and the active build configuration to "Release" (or "Distribution", if you created a new configuration). Show me
6. Open the "Build Results" window (↑⌘B) under the "Build" menu.
I like to "Clean All Targets" at this point before building the distribution relrease. (It's in the Build menu.)
7. Click "Build", and watch the build progress in the results window. Make sure it completes all the way through to the "Code Sign" step. (If the build fails, or you don't get to the final Code Sign step, something's gone wrong. Start over and be sure you've selected the proper sdk/build configuration/distribution certificates.) Show me
8. Close the build results window. In the XCode "Products" folder, look for YourAppName.app. Control-click on the app name and select "Reveal In Finder". Show me
9. In the finder, control-click on the app name and choose "Compress" to create a zip file of it.
10. Drag the resulting zip file out to your desktop or somewhere you can easily find it.
Now you're ready to submit the app to the app store.