Skip to main content

iOS 应用商店部署

要求

¥Requirements

将应用提交到 iOS 应用商店需要满足以下条件:

¥Submitting an App to the iOS App store requires a few things:

  • Xcode

  • 付费苹果开发者账户

    ¥A Paid Apple Developers account

  • 有效的配置文件

    ¥A valid provisioning profile

  • 应用开发和分发证书

    ¥App Development and Distribution certificates

要注册 Apple 开发者计划,请按照说明进行操作 此处列出

¥To enroll in the Apple Developer Program, follow the instructions listed here.

生成发布版本

¥Generating a release build

如果尚未添加 iOS 平台,请务必添加:

¥If the iOS platform is not already added, be sure to add it:

ionic cap add ios

添加平台后,使用 --prod 标志运行构建命令:

¥With the platform added, run the build command with the --prod flag:

ionic build --prod

这将为应用的 Web 部分生成精简代码。

¥This will generate the minified code for the web portion of an app.

对于第一个构建,在进行任何二进制更改(例如添加插件)后,请使用同步命令:

¥For this first build, and after you make any binary changes like adding a plugin, use the sync command:

npx cap sync ios

这也将复制缩小的网络代码。但是,如果你的构建只是源代码更改,那么你可以使用以下命令复制缩小的 Web 文件:

¥This will also copy the minified web code over. However, if your build is only source change then you can just copy the minified web files using:

npx cap copy ios

从这里开始,该项目现在的管理方式就好像它是一个原生 Xcode 应用一样(因为它确实如此)。

¥From here, the project is now managed as if it was a native Xcode app (because it is).

打开 ./ios/ 中的项目启动 Xcode:

¥Open the project in ./ios/ to start Xcode:

npx cap open ios

生成签名证书

¥Generating Signing Certs

为 iOS 生成证书是一个复杂的过程,因此请务必检查 苹果官方文档 以了解证书是什么以及如何生成证书。

¥Generating certificates for iOS is a bit of an involved process, so be sure to check Apple's official documentation on what certificates are and how to generate them.

要创建所需的证书和配置文件,请访问 苹果会员中心 并点击 Apple 文档中描述的链接。

¥To create the certificates and profiles needed, visit Apple's member center and follow the links described in Apple's documentation.

这里有两种类型的证书很重要:开发证书和分发证书。开发证书就是为了开发时间而设计的。它们的目的是对应用进行签名并将其部署到证书有权访问的设备。

¥There are two types of certificates that matter here, Development, and Distribution. Development Certificates are just that, meant for development time. They are meant to sign an app and deploy it to devices that the certificate has access to.

分发证书用于将应用分发到商店。当应用使用分发证书进行签名时,它可以安装在任何设备上。

¥Distribution certs are meant for distributing an app to the store. When an app is signed with a Distribution cert, it can be installed on any device.

在 Xcode 中签署应用

¥Signing the App in Xcode

生成正确的证书后,可以选择让 Xcode 自动管理证书或手动管理证书。建议让 Xcode 自动管理证书。这将确保根据所选的构建类型使用正确的开发和分发证书。

¥After generating the correct certificates, there are options to either have Xcode automatically manage certificates or manually manage them. It's suggested to let Xcode automatically manage certificates. This will make sure that the correct Development and Distribution certs are used, based on the build type selected.

选择此选项后,从 Product > Archive 菜单中选择 Archive。这将构建一个可以在应用商店中分发的应用版本。创建存档后,Xcode Organizer 将打开。

¥With this option selected, select Archive from the Product > Archive menu. This will build a version of the app that is ready for distribution in the app stores. After archive has been created, Xcode Organizer is opened.

Xcode Organizer 显示包含当前应用版本的列表。选择最后一个版本并单击 '上传至应用商店'。应该有一个地方可以选择团队,然后是有关应用的更多信息和一个可供单击的 '上传' 按钮。

¥Xcode Organizer displays a list with builds of the current app. Pick the last build and click 'Upload to App Store'. There should be a place to select the team followed by some more information on the app and an 'Upload' button to click.

如果上传成功,该应用应在 iTunes 连接 的 '活动' 下列出或在 应用商店连接 的 '应用' 下列出。从那里,应用可以发布到 TestFlight,或者可以发送到 Apple 以获得 App Store 的批准。

¥If the upload is successful the app should be listed under 'Activities' on iTunes Connect or listed under 'Apps' on App Store Connect. From there, the app can be published to TestFlight, or it can be sent to Apple for approval for the App Store.

更新应用

¥Updating an app

随着应用的发展,需要使用新功能和修复进行更新。可以通过向 Apple 提交新版本或使用 Appflow 的 实时更新功能 等实时更新服务来更新应用。

¥As an app grows, it will need to be updated with new features and fixes. An app can be updated by either submitting a new version to Apple, or by using a live update service like Appflow's live update feature.

借助实时更新,应用更改可以从 Appflow 仪表板直接实时推送给用户,而无需等待 App Store 批准。

¥With Live Updates, app changes can be pushed in realtime directly to users from the Appflow dashboard, without waiting for App Store approvals.

注意

为了让 iOS App Store 接受更新的版本,需要编辑 config.xml 文件以增加版本值,然后按照上述相同的说明重建应用以进行发布。

¥In order for the iOS App Store to accept the updated build, the config.xml file will need to be edited to increment the version value, then rebuild the app for release following the same instructions above.