How to create an IPA (Xcode 5)

This tutorial will walk you through the easiest way to generate an IPA using Xcode 5. We will be using a sample project which will walk through creating the project to IPA generation.

NOTE: This tutorial only covers how to configure your project in order to package the application as an IPA. It does not cover how to create or migrate a project with or without 3rd party libraries.

NOTE: You will need an Apple Developer or Enterprise account to prepare an .IPA to be distributed.
 


Creating the Basic Application

  1. Choose a template for your new project. For this sample application, we will be creating a Single View Application.
  2. Enter your product name, company identifier, and other configuration options. The product name and company identifier will be combined to generate the Bundle Identifier. This will be used later to determine which provisioning profiles can be used when building and sharing the application.
  3. In the file list on the left drop down menu, select your target. On the General tab, notice the Bundle Identifier has been generated based on the values entered in step 2.
  4. Go to the Build Settings tab and scroll down to the Code Signing section and expand the Provisioning Profile settings. For the two default build configurations (Debug and Release), select your Development Provisioning Profile for Debug and your Ad Hoc Provisioning Profile for Release. 
     
  5. In the dropdown in the top left, select Edit Scheme. You will notice that the default build configurations have already been configured based on the build action being performed. If you are performing a Run action (Product -> Run) to test your application on the iOSSimulator or on your device, your app will be built using the Debug configuration, which in turn signs your app with the Development Provisioning Profile. If you are performing an Archive action (Product -> Archive), your app will be built with the Release configuration, which in turn signs your app with your Distribution Provisioning Profile (either Ad Hoc or App Store). 


Generate the IPA

The easiest way to generate an IPA, which can be uploaded to TestFlight, is to archive your applications and share it from the Xcode Organizer.

  1. Change the build target from iPad/iPhone Simulator to iOS Device.
  2. Under the Product menu, select Archive. This will build your application and code sign it using the Distribution (Ad Hoc or App Store) profilesetup in step 5 of the “Creating the Basic Application” section. Once the build has completed the Organizer window will appear. If it does not, open it using CMD-Shift–2 or Window -> Organizer. If you see a message popup saying “codesign wants to sign using key ”privateKey“ in yourkeychain.”, select Allow or Always Allow.
  3. Go to the Archives tab in Organizer and select your application, if it was not automatically selected, and choose the archive you wish to share.
  4. Click the Distribute button. In the next window select “Save for Enterprise or Ad-Hoc Deployment”, and click Next.
  5. In the Code Signing Identity drop down, select the same Distribution Provisioning Profile specified in the Release configuration from step 5 of the “Creating the Basic Application” section, and click Next. NOTE: When generating an IPA for distribution on TestFlight, you should always use an Ad Hoc Distribution Provisioning Profile for both the Archive and Distribute options.
  6. Select where you would like to save your IPA and upload to TestFlight.

 

Commonly Asked Questions

Q: Why must I use the same provisioning profile when archiving and generating my IPA?
A: When your application is compiled, information from the provisioning profile used to codesign your application is embedded in the application executable. When you generate your IPA, your application is codesigned again and the provisioning profile used to codesign is added to the IPA as the embedded.mobileprovision file. If there is a mismatch in certain pieces of information between the profile info in the executable and the profile info in the embedded.mobileprovision, this can cause the install to fail.

posted @ 2015-01-29 17:06  如来藏  阅读(280)  评论(0编辑  收藏  举报