提交App到Apple Store(Xcode4)

时间:2024-01-06 08:55:56

昨 天终于顺利把公司的App提交了,还是很开心的。这是我第一个开发超过2个月的项目,开发期间学到了很多东西,接下来的时间我会逐渐梳理一下。来个倒叙, 今天就先说下怎么提交的吧。Xcode4以后,提交过程变的简单,除了写各种应用描述以外,整个提交过程不需要半个小时。

发布App的准备工作要在itunesconnect进行,这里引导很好,一步步来就可以了。
SKU 随便写,只要唯一就可以了。
Bundle ID 通常是反序域名 eg. com.sinaapp.ppwithcc
Apple ID 这个是系统给的,我们的每个应用都有一个App id

https://itunesconnect.apple.com/

提交App到Apple Store(Xcode4)

要说的重点是在Developer Provisioning Portal里的设置,有开发者账号的朋友对这个这个界面并不陌生,要想在真机上调试,这里的各种配置是免不了的。一开始往往被这里复杂的流程吓着。
提交App到Apple Store(Xcode4)

确实很复杂,下面是苹果的官方文档。我就标记一下重点吧,实在是懒得重写一遍,而且我写的指定没有它的翔实全面。

DISTRIBUTION

提交App到Apple Store(Xcode4)

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 Lion (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”.
    提交App到Apple Store(Xcode4)
  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>…”提交App到Apple Store(Xcode4)
  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’.
    提交App到Apple Store(Xcode4)
  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’.
    提交App到Apple Store(Xcode4)
  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.
    提交App到Apple Store(Xcode4)
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.
    提交App到Apple Store(Xcode4)
Saving your Private Key and Transferring to Other Systems

//接下来的这一段是一个插曲,告诉我们可以把私钥保存起来,以备下次使用。这里功能是非常方便的,尤其是有多个人开发或者换了电脑。只要把.p12文件导入一遍,就可以直接用了,不需要重新进入这里设置什么。

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.
    提交App到Apple Store(Xcode4)
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.提交App到Apple Store(Xcode4)
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”.

提交App到Apple Store(Xcode4)

    1. In the Target Info window, select the ‘Build’ tab and set the ‘Configuration’ to ‘Distribution’

提交App到Apple Store(Xcode4)

    1. 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.提交App到Apple Store(Xcode4)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.提交App到Apple Store(Xcode4)
    2. 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.提交App到Apple Store(Xcode4)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>
    3. In
      the project window, select the Distribution Active Configuration from
      the overview popup and set the Active SDK to the desired Device.提交App到Apple Store(Xcode4)
      For App Store Distribution, skip to Step 12. For Ad Hoc Distribution, complete the following:
    4. In the File Menu, select New File -> iPhone OS -> Code Signing -> Entitlements.

提交App到Apple Store(Xcode4)

    1. Name the file “Entitlements.plist” and click ‘Finish’. This creates a copy of the default entitlements file within the project.

提交App到Apple Store(Xcode4)

    1. Select the new Entitlments.plist file and uncheck the “get-task-allow” property. Save the Entitlements.plist file.

提交App到Apple Store(Xcode4)

    1. 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.

提交App到Apple Store(Xcode4)

    1. Click
      ‘Build’. (Note: Your binary must contain a flattened, square-image icon
      that is 57×57 pixels. This icon is displayed on the iPhone or iPod
      touch home screen.)
    2. Highlight the app located within the “Products” sub-folder and select ‘Reveal in Finder’ from the Action popup.

提交App到Apple Store(Xcode4)

    1. 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.

提交App到Apple Store(Xcode4)

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.

提交App到Apple Store(Xcode4)

    1. 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.

提交App到Apple Store(Xcode4)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).

提交App到Apple Store(Xcode4)

都设置好了的话,就可以准备分发了。Xcode4下,点击Project-Archive, 程序编译好后就出现了下面的界面

提交App到Apple Store(Xcode4)

左边是程序的相关信息,右边是我们要进行的两个操作
1.首先是要 Validate 一下我们准备好的程序,会连接itunesconnnet进行验证。验证通过后程序的状态会变为 Passed Validation。吼吼,这样第一步就成功了。

2.
然后就是准备Distribute了,注意选好相应的证书。然后选择是提交到App Store,
接下来就是静静等待上传,上传成功后程序状态变为上图中的Submitted状态。到这时候还不算是提交成功了,还得登上itunesconnect看看
App的状态是不是waiting review。我第一次提交的时候就遇到了上传成功,但是binary file有问题的情况。

今天先写到这里,下次提交的时候再补充吧。

摘自:http://765i.cn/?p=256