Skip to main content

iOS 应用商店部署

要求

🌐 Requirements

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

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

  • Xcode
  • 付费苹果开发者账户
  • 有效的配置文件
  • 应用开发和分发证书

要注册 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

这也会复制压缩后的网页代码。但是,如果你的构建只是源代码的更改,那么你可以只使用以下方法复制压缩后的网页文件:

🌐 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 的会员中心 并按照 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 组织器将会打开。

🌐 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 显示当前应用的构建列表。选择最后一个构建并点击“上传到 App Store”。 应该有一个地方可以选择团队,随后是一些关于应用的更多信息,以及一个可以点击的“上传”按钮。

🌐 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 Connect 的“活动”下列出,或在 App Store Connect 的“应用”下列出。从那里,应用可以发布到 TestFlight,或者可以发送给苹果以获得 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 的 实时更新功能这样的实时更新服务。

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

note

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