This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

为 iOS 创建生产版本

了解为 iOS 创建生产版本和自动化发布过程的过程。


在本章中,我们将创建示例应用的生产版本,并使用 TestFlight 提交测试。之后,我们将提交应用进行 App Store 审核,以便上架到 App Store。

🌐 In this chapter, we'll create our example app's production version and submit it for testing using TestFlight. After that, we'll submit them for App Store review to get it on the App Store.

观看:为 iOS 创建和发布生产版本
观看:为 iOS 创建和发布生产版本

使用 EAS 为 iOS 创建生产版本,使用 TestFlight 测试,然后提交到 App Store。


先决条件

2 要求

1.

苹果开发者账号

要创建一个,请参阅 Apple 开发者门户。

2.

eas.json 中的生产构建配置文件

确保在你的 eas.json 中存在一个 production 构建配置文件,该文件默认会被添加。

iOS 的生产版本

🌐 Production build for iOS

一个生产 iOS 构建 已针对苹果的 App Store Connect 进行了优化,它允许通过 TestFlight 分发构建给测试人员,并通过 App Store 分发给公众用户。这种构建类型无法在模拟器或设备上侧载,只能通过 App Store Connect 分发。

🌐 A production iOS build is optimized for Apple's App Store Connect, which allows distributing builds to testers with TestFlight and public end users through the App Store. This build type cannot be side-loaded on a simulator or device and can only be distributed through App Store Connect.

1

创建分发配置文件

🌐 Create a distribution provisioning profile

在终端中运行 eas credentials 命令,然后根据 EAS CLI 的提示回答以下问题:

🌐 Run the eas credentials command in the terminal and then answer the following prompts by EAS CLI:

  • 选择平台 iOS。
  • 你想配置哪个构建配置文件? 选择生产环境。
  • 你想登录你的 Apple 账户吗? 按 Y。这将登录我们的 Apple 开发者账户。
  • 你想做什么? 选择 生成凭据,然后选择 全部:设置构建项目所需的所有凭据。
  • 现在,它会提示我们是否想要重复使用之前的分发证书。按 Y。
  • 生成新的 Apple 配置文件? 按 Y。这将是生产应用的配置文件。
  • 创建配置文件后,按任意 Ctrl + C 退出 EAS CLI。

2

创建生产版本

🌐 Create a production build

要使用默认的 production 配置文件创建 iOS 生产版本,请打开终端并执行以下命令。由于 production 已在 EAS 配置中设置为默认配置文件,因此无需使用 --profile 标志显式指定它。

🌐 To create an iOS production build using the default production profile, open your terminal and execute the following command. Since production is set as the default profile in the EAS configuration, there is no need to specify it explicitly with the --profile flag.

Terminal
- eas build --platform ios

该命令将排队构建。在 EAS 仪表板上注意,构建编号会自动递增。

🌐 The command will queue the build. Notice on the EAS dashboard that the Build Number is auto-incremented.

3

将应用二进制文件提交到 App Store

🌐 Submit the app binary to the App Store

要提交从我们最新的 EAS 构建创建的应用二进制文件,请运行 eas submit 命令:

🌐 To submit the app binary created from our latest EAS Build, run the eas submit command:

Terminal
- eas submit --platform ios

运行此命令后,我们需要:

🌐 After running this command, we need to:

  • **从 EAS 选择一个构建。**让我们选择最新的构建 ID。
  • 按照提示登录我们的 Apple 账户。 当出现 是否重用此 App Store Connect API 密钥? 时,按 Y。

这将触发提交过程。

🌐 This will trigger the submission process.

4

发布内部测试版本

🌐 Release an internal testing version

提交过程完成后,我们需要从网页浏览器登录 Apple 开发者账号。

🌐 After the submission process is complete, we'll need to log in to the Apple Developer account from the web browser.

  • 点击 应用,查看应用图标。
  • 点击应用名称,然后在导航标签菜单中点击 TestFlight。如果版本刚提交,Apple 处理该版本可能需要几分钟,然后才能通过 TestFlight 进行分发。
  • 在 App Store Connect 中,进入 内部测试,并创建一个测试组。这将允许我们邀请测试用户。
  • 一旦创建了该群组,邮件将会发送给所有测试用户。
  • 在电子邮件中,点击 在 TestFlight 中查看,接受邀请,然后点击 安装。

之后,应用将会下载到我们的设备上,以便我们进行测试。

🌐 After that, the app will download on our device so that we can test it.

5

将应用提交到苹果应用商店

🌐 Submit the app to the Apple App Store

要为我们的应用准备提交到 App Store,请转到 App Store 选项卡:

🌐 To prepare our app for App Store submission, go to the App Store tab:

  • 提供元数据详细信息,按照苹果的指南提供截图,并在常规下填写详细信息。
  • 然后,手动选择构建。
  • 一旦我们的应用准备就绪,点击 提交应用审查。之后,苹果会审核我们的应用,如果通过审核,应用将会上架到 App Store。

6

自动提交

🌐 Automated submissions

对于未来的版本,我们可以通过在 eas build 中使用 --auto-submit 标志,将构建创建和 App Store 提交合并为单一步骤,从而简化流程:

🌐 For future releases, we can streamline the process by combining build creation and App Store submission into a single step by using the --auto-submit flag with eas build:

Terminal
- eas build --platform ios --auto-submit

概括

🌐 Summary

Chapter 9: Create a production build for iOS

We successfully created a production-ready iOS build, discussed distribution using TestFlight and Apple App Store using eas submit, and automated the release process with the --auto-submit.

In the next chapter, learn how to use the EAS Update to send OTA updates and share previews with our team.

下一个:Chapter 10: Share previews with your team