了解为 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.
¥Prerequisites
要在 Apple Play Store 上发布和分发应用,我们需要:
¥To publish and distribute an app on the Apple Play Store, we need:
苹果开发者账户:要创建一个,请参阅 苹果开发者门户。
¥Apple Developer account: To create one, see Apple Developer Portal.
生产构建简介:确保你的 eas.json 中存在 production
构建配置文件,该配置文件是默认添加的。
¥Production build profile: Ensure that a production
build profile is present in your eas.json, which is added by default.
¥Production build for iOS
生产 iOS 构建 针对 Apple 的 App Store Connect 进行了优化,允许通过 App Store 将构建版本分发给 TestFlight 测试人员和公共终端用户。此构建类型无法在模拟器或设备上旁加载,只能通过 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。
¥Select platform iOS.
你想要配置哪个构建配置文件?选择生产。
¥Which build profile do you want to configure? Select production.
你想登录你的 Apple 账户吗?按 Y。这将登录我们的 Apple 开发者账户。
¥Do you want to log in to your Apple account? Press Y. This will log in to our Apple Developer account.
你想让我做什么?选择构建凭据并选择全部:设置构建项目所需的所有凭据。
¥What do you want to do? Select Build credentials and choose All: Set up all the required credentials to build your project.
现在,它会提示我们是否要重新使用以前的分发证书。按 Y。
¥Now, it will prompt whether we want to re-use the previous Distribution Certificate. Press Y.
生成新的 Apple 配置文件吗?按 Y。这将是生产应用的配置文件。
¥Generate a new Apple Provisioning Profile? Press Y. This will be the provisioning profile for the production app.
按任意键退出 EAS CLI。
¥Press any key to exit the 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.
-
eas build --platform ios
该命令将对构建进行排队。请注意 Expo 仪表板上的内部版本号是自动递增的。
¥The command will queue the build. Notice on the Expo dashboard that the Build Number is auto-incremented.
3
¥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:
-
eas submit --platform ios
运行此命令后,我们需要:
¥After running this command, we need to:
从 EAS 选择构建。让我们选择最新的构建 ID。
¥Select a build from EAS. Let's select the latest build ID.
按照提示登录我们的苹果账户。当它要求重新使用此 App Store Connect API 密钥时?按 Y。
¥Follow the prompt to log in to our Apple account. When it asks for Reuse this App Store Connect API Key? Press 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.
单击 应用,然后查看应用图标。
¥Click Apps, and see the app icon.
单击应用名称,然后从导航选项卡菜单中单击 TestFlight。如果构建刚刚提交,Apple 可能需要几分钟的时间来处理构建,然后才能使用 TestFlight 进行分发。
¥Click the app name, and from the navigation tab menu, click TestFlight. If the build was just submitted, it may take a few minutes for Apple to process the build before it is available to distribute with TestFlight.
单击管理合规性链接。由于我们的应用不使用任何加密,因此选择“无上述算法”。
¥Click on the Manage Compliance link. Since our app doesn't use any encryption, select None of the algorithms mentioned above.
提示:下次创建应用时,请通过在应用配置中添加ios.config.usesNonExemptEncryption
来跳过此合规性,如果应用不使用任何加密,则将其设置为false
。
在 App Store Connect 中的内部测试下,创建一个测试组。这将使我们能够邀请测试用户。
¥In App Store Connect, under Internal Testing, and create a test group. This will allow us to invite test users.
创建组后,将向所有测试用户发送一封电子邮件。
¥Once the group is created, an email will be sent to all the test users.
在电子邮件中,单击“在 TestFlight 中查看”,接受邀请,然后点击“安装”。
¥In the email, click View in TestFlight, accept the invite, and then tap Install.
之后,该应用将下载到我们的设备上,以便我们可以对其进行测试。
¥After that, the app will download on our device so that we can test it.
注意:与内部测试类似,我们也可以使用 TestFlight 创建一个邀请外部测试人员的群组。在内部测试限制为 100 名用户的情况下,TestFlight 允许与最多 10,000 名测试人员在外部共享测试发布版本,并提供可公开共享的链接。为了简洁起见,我们不会在本教程中介绍这些步骤。
¥Note: Similar to internal testing, we can also create a group for inviting external testers using TestFlight. Where internal testing has a limit of 100 users, TestFlight allows sharing a test release version externally with up to 10,000 testers and provides a publicly shareable link. For brevity, we are not going to cover those steps in this tutorial.
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:
提供元数据详细信息,根据 Apple 指南提供屏幕截图,并在“常规”下填写详细信息。
¥Provide metadata details, provide screenshots as per Apple's guidelines and also fill details under General.
然后,手动选择构建。
¥Then, manually select the build.
完整的应用商店列表:要准备应用的商品详情,请参阅 创建应用商店资源 了解如何创建屏幕截图和预览。
¥Complete App Store listing: To prepare the app for store listing, see Create app store assets on how to create screenshots and previews.
我们的应用准备就绪后,单击“提交至应用审核”。之后,Apple 将审核我们的应用,如果获得批准,该应用将在 App Store 上架。
¥Once our app is ready, click on Submit to App Review. After that, Apple will review our app, and if approved, the app will be available on the App Store.
6
¥Automated submissions
对于未来的版本,我们可以通过使用 --auto-submit
标志和 eas build
将构建创建和 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
:
-
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.