如何发布iPhone程序

Distribution

Distribution

The distribution area of the iOS Provisioning Portal is where you will prepare and learn how to submit your iPhone and/or iPod touch application for delivery via in-house or Ad Hoc distribution. Only Team Agents are authorized to prepare and submit applications for distribution.

For information about distributing your application on the App Store, please see the App Store tab.

Obtaining your iOS Distribution Certificate

In order to distribute your iOS application, the Team Agent is required by Apple to create an iOS Distribution Certificate. Only the Team Agent for your team will be able to create this certificate and only this certificate will enable application submission.

Generating a Certificate Signing Request

To request an iOS Distribution Certificate, you first need to generate a Certificate Signing Request (CSR) utilizing the Keychain Access application in Mac OS X Leopard. The creation of a CSR will prompt Keychain Access to simultaneously generate your public and private key pair establishing your iOS Distribution identity. Your private key is stored in the login Keychain by default and can be viewed in the Keychain Access application under the ‘Keys’ category. To generate a CSR:

  1. In your Applications folder, open the Utilities folder and launch Keychain Access.
  2. In the Preferences menu, set Online Certificate Status Protocol (OSCP) and Certificate Revocation List (CRL) to “Off”.
    OCSP Preferences
  3. Choose Keychain Access -> Certificate Assistant -> Request a Certificate from a Certificate Authority. Note: If you have a private key highlighted in the Keychain during this process, the resulting Certificate Request will not be accepted by the Provisioning Portal. Confirm that you are selecting “Request a Certificate From a Certificate Authority...” and not selecting “Request a Certificate From a Certificate Authority with <Private Key>…”

    Request a Certificate

  4. In the User Email Address field, enter your email address. Please ensure that the email address entered matches the information that was submitted when you registered as an iOS Developer.
  5. In the Common Name field enter your Company/Organization/Department name. Please ensure that the name entered matches the information that was submitted when you registered as an iOS Developer.
  6. No CA Email Address is required.
  7. Select the ‘Saved to Disk’ radio button and if present, select ‘Let me specify key pair information’ and click ‘Continue’.
    Save Certificate to Disk
  8. If ‘Let me specify key pair’ was selected, specify a file name and click ‘Save’. In the following screen select ‘2048 bits’ for the Key Size and ‘RSA’ for the Algorithm. Click ‘Continue’.
    Key Pair Information
  9. The Certificate Assistant will create a CSR file on your desktop.
Submitting a Certificate Signing Request for Approval
  1. After creating a CSR, log in to the iOS Provisioning Portal and navigate to ‘Certificates’ -> ‘Distribution’ and click the ‘Add Certificate’ button.
  2. Click the Upload file button, select your CSR and click ‘Submit’. If the Key Size was not set to 2048 bits during the CSR creation process, the Portal will reject the CSR.
  3. Approve your iOS Distribution Certificate.
    Create Distribution Certificate
Downloading and Installing iOS Distribution Certificates
  1. In the ‘Certificates’-->’Distribution’ section of the Portal, Control-Click the WWDR Intermediate Certificate link and select “Saved Linked File to Downloads” to initiate download of the certificate. After downloading, double-click the certificate to launch Keychain Access and install.
  2. In the same area of the Provisioning Portal, click on the name of the iOS Distribution Certificate to download.
  3. On your local machine, double-click the downloaded .cer file to launch Keychain Access and install your certificate.
    Current Distribution Certificates
Saving your Private Key and Transferring to Other Systems

It is critical that you save your private key somewhere safe in the event that you need to build your application on multiple Macs or decide to reinstall your system OS. Without your private key, you cannot sign binaries in Xcode and there you will be unable to upload your application to the App Store or install your application on any Apple device. When a CSR is generated, the Keychain Access application creates a private key on your login keychain. This private key is tied to your user account and cannot be reproduced if lost due to an OS reinstall. If you plan to do development and testing on multiple systems, you will need to import your private key onto all of the systems you’ll be doing work on.

  1. To export your private key and certificate for safe-keeping, open up the Keychain Access Application and select the “Keys” category.
  2. Highlight the private key associated with your iOS Distribution Certificate and select “Export Items” from the ‘File’ menu. Save your key in the Personal Information Exchange (.p12) file format.
  3. You will be prompted to create a password which will be used when you attempt to import this key on another computer.
  4. You can now transfer this .p12 file between systems. Double-click on the .p12 to install on a system. You will be prompted for the password you first entered above.
Create and download your iOS Distribution Provisioning Profile for App Store Distribution

To successfully build your application with Xcode for distribution via the App Store, you first need to create and download an App Store Distribution Provisioning Profile. These are different than the Development Provisioning Profiles that were used earlier in that Apple will only accept applications if they are built with an App Store Distribution Provisioning Profile.

Note: App Store provisioning profiles do not allow for a distribution built application to be installed on an Apple device. To install your distribution ready application on a device, you must create an Ad Hoc provisioning profile.

  1. Team Agents should navigate to the Provisioning section of the Provisioning Portal and select the Distribution tab.
  2. Select the App Store radio button.
  3. Enter the name for your Distribution Provisioning Profile.
  4. Confirm your iOS Distribution Certificate has been created and is displayed.
  5. Select your wild-card App ID to build all of your applications with your single Distribution Provisioning Profile.
  6. Click ‘Submit’.
  7. Click on the name of the Distribution Provisioning Profile to download the .mobileprovision file.
  8. Drag the .mobileprovision onto the Xcode or iTunes icon in the dock to install.
    Create Provisioning Profile

Creating and Downloading a Distribution Provisioning Profile for Ad Hoc Distribution

To successfully build your application in Xcode for Ad Hoc distribution, you will need to create and download an Ad Hoc Distribution Provisioning Profile.

  1. Team Agents should navigate to the ‘Provisioning’ section of the Provisioning Portal.
  2. Select the ‘Ad Hoc’ radio button.
  3. Enter the name for your Ad Hoc Distribution Provisioning Profile.
  4. Confirm your iOS Distribution Certificate has been created and is displayed.
  5. Select the App ID for the application (or suite of applications) you wish to distribute.
  6. Select up to 100 UDIDs which you wish to run your application on.
  7. Click ‘Submit’.
  8. Click on the name of the Distribution Provisioning Profile to download the .mobileprovision file.
  9. Drag the .mobileprovision onto the Xcode or iTunes icon in the dock to install.

    Distribution Provisioning Profile for Ad Hoc Distribution
Building your Application with Xcode for Distribution
  1. Launch Xcode and open your project.
  2. If you have not already done so, drag the Distribution Provisioning Profile downloaded from the Provisioning Portal onto the Xcode or iTunes icon in the dock (or, drag into ‘~/Library/MobileDevice/Provisioning Profiles’ directory.)
  3. Open the Xcode project and Duplicate the “Release” configuration in the Configurations pane of the project's Info panel. Rename this new configuration “Distribution”.Duplicate Release Configuration
  4. In the Target Info window, select the ‘Build’ tab and set the ‘Configuration’ to ‘Distribution’Change the Code Signing Identity
  5. In the Target Info window, navigate to the ‘Build’ pane. Click the ‘Any iOS Device’ pop-up menu below the ‘Code Signing Identity’ field and select the iOS Distribution Certificate/Provisioning Profile pair you wish to sign and install your code with. Your iOS Distribution certificate will be in bold with the Provisioning Profile associated with it in grey above. In the example below, ‘iOS Distribution : Example Corp, Inc.’ is the Distribution Certificate and ‘My App Store Distribution Provisioning Profile’ is the .mobileprovision file paired with it.

    Set the 'Configuration' to 'Distribution'

    Note: If the private key for your iOS Distribution certificate is missing, you will be unable to select the iOS Distribution Certificate/Provisioning Profile pair and you will see the following. Importing the private key for your iOS Distribution certificate will correct this.

    Import the Private Key
  6. In the Properties Pane of the Target Info window, enter the Bundle Identifier portion of your App ID. If you have used an explicit App ID you must enter the Bundle Identifier portion of the App ID in the Identifier field. For example enter com.domainname.applicationname if your App ID is A1B2C3D4E5.com.domainname.applicationname. If you have used a wildcard asterisk character in your App ID, replace the asterisk with whatever string you choose.

    Enter the Bundle Identifier

    Here are example App IDs and what should be input into the Identifier field in Xcode.

    • Example App ID: A1B2C3D4E5.com.domainname.applicationname
      Identifier to enter in Xcode: com.domainname.applicationname

    • Example App ID: A1B2C3D4E5.com.domainname.*
      Identifier to enter in Xcode: com.domainname.<name_of_application_or_suite>

    • Example App ID: A1B2C3D4E5.*
      Identifier to enter in Xcode: <full_reverse_dns_company_and_application_or_suite_name>

  7. In the project window, select the Distribution Active Configuration from the overview popup and set the Active SDK to the desired Device.

    Select Active Configuration 
    For App Store Distribution, skip to Step 12. For Ad Hoc Distribution, complete the following:

  8. In the File Menu, select New File -> iPhone OS -> Code Signing -> Entitlements.Code Signing Entitlements
  9. Name the file “Entitlements.plist" and click ‘Finish’. This creates a copy of the default entitlements file within the project.Entitlements.plist File
  10. Select the new Entitlments.plist file and uncheck the “get-task-allow” property. Save the Entitlements.plist file.Set-Task-Allow
  11. Select the Target and open the Build settings inspector. In the ‘Code Signing Entitlements’ build setting, type in the filename of the new Entitlements.plist file including the extension. There is no need to specify a path unless you have put the Entitlements.plist file somewhere other than the top level of the project.Specify new Entitlements.plist File
  12. Click ‘Build’. (Note: Your binary must contain a flattened, square-image icon that is 57x57 pixels. This icon is displayed on the iPhone or iPod touch home screen.)
  13. Highlight the app located within the "Products" sub-folder and select ‘Reveal in Finder’ from the Action popup.Reveal in Finder
  14. Use the compress option in Finder to create a .zip file containing your application. Be sure to compress only the .app file only and not the entire build folder.Create a .zip archive
Verifying a Successful Distribution Build

To confirm your build was successful, check for the following:

  1. Open the Build Log detail view and confirm the presence of the "embedded.mobileprovision” file. This will take you to the line in the build log that shows the provisioning profile was successfully called. Ensure that the embedded.mobileproviion is located in the proper “Distribution” build directory and is not located in a “Debug” or “Release” build directory. Also, confirm that the destination path (at the very end of the build message) is the app you are building.Build Results
  2. Search for the term “CodeSign” in the Build Log detail view - this will take you to the line in the build log that confirms your application was signed by your iOS Certificate.Build Log

If your project is lacking any of the above files or pointing to the wrong directory, do the following:

  1. Select the Target and open the Build Settings Inspector. Confirm you are in the Distribution Configuration.
  2. Delete the Code Signing Identity: iOS Distribution : COMPANYNAME
  3. In the Xcode Build Menu, select Clean all Targets.
  4. Delete any existing build directories in your Xcode project using Finder.
  5. Re-launch Xcode and open your Project.
  6. Re-enter the code-signing identity iOS Distribution : COMPANYNAME in the Target Build Settings Inspector.
  7. Rebuild your Project.
Updating your Application

The App Store uses three pieces of information in your application to identify a submission as an update to an existing application. *When you are submitting an update of your application to iTunes Connect for App Store distribution, make sure to:

  1. Use the same Distribution Provisioning Profile to build each new version of your application
  2. Increment the CFBundleVersion and CFBundleShortVersionString values in your project Info.plist file. Note: Version numbers must be period-delimited sequences of positive integers (1.0 to 1.1, or 2.2.1 to 2.2.2).CF Bundle Version
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值