提交至苹果应用商店

了解如何通过计算机和 CI/CD 服务将应用提交到 Apple App Store。


本指南概述了如何从计算机或 CI/CD 服务将你的应用提交到 Apple App Store。

🌐 This guide outlines how to submit your app to the Apple App Store from your computer or from a CI/CD service.

从你的电脑

🌐 Submitting your app from your computer

Prerequisites

4 requirements

1.

注册 Apple 开发者账户

提交应用到苹果应用商店需要 Apple 开发者账户。你可以在 Apple Developer Portal 注册 Apple 开发者账户。

2.

在 app.json 中包含一个打包标识符

app.json 中包含你的应用打包标识符:

app.json
{ "ios": { "bundleIdentifier": "com.yourcompany.yourapp" } }

3.

安装 EAS CLI 并使用你的 Expo 账户进行身份验证

安装 EAS CLI 并使用你的 Expo 账户登录:

Terminal
npm install -g eas-cli && eas login

4.

构建一个生产应用

You'll need a production build ready for store submission. You can create one using EAS Build:

Terminal
eas build --platform ios --profile production

或者,你可以在自己的电脑上使用 eas build --platform ios --profile production --local 或 Xcode 构建该应用。

完成所有先决条件后,即可启动提交流程。

🌐 Once you have completed all the prerequisites, you can start the submission process.

运行以下命令将构建提交到 Apple App Store:

🌐 Run the following command to submit a build to the Apple App Store:

Terminal
eas submit --platform ios

该命令将一步一步引导你完成提交应用的过程。你可以通过在 eas.json 中添加提交配置文件来配置提交流程:

🌐 The command will lead you step by step through the process of submitting the app. You can configure the submission process by adding a submission profile in eas.json:

eas.json
{ "submit": { "production": { "ios": { "ascAppId": "your-app-store-connect-app-id" } } } }
如何找到 ascAppId
  1. 登录 App Store Connect 并选择你的团队。
  2. 导航到 应用
  3. 点击你的应用。
  4. 确保 App Store 标签处于激活状态。
  5. 在左侧窗格的 常规 部分,选择 应用信息
  6. 你的应用的 ascAppId 可在 Apple ID 下的 一般信息 部分找到。

了解你可以在 eas.json 参考 中提供的所有选项。

🌐 Learn about all the options you can provide in the eas.json reference.

为了加快提交过程,你可以使用 --auto-submit 标志在构建完成后自动提交构建:

🌐 To speed up the submission process, you can use the --auto-submit flag to automatically submit a build after it's built:

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

自动提交指南中了解更多关于 --auto-submit 标志的信息。

🌐 Learn more about the --auto-submit flag in the automate submissions guide.

使用 CI/CD 服务提交你的应用

🌐 Submitting your app using CI/CD services

Prerequisites

5 requirements

1.

注册 Apple 开发者账户

提交应用到苹果应用商店需要 Apple 开发者账户。你可以在 Apple Developer Portal 注册 Apple 开发者账户。

2.

在 app.json 中包含一个打包标识符

app.json 中包含你的应用打包标识符:

app.json
{ "ios": { "bundleIdentifier": "com.yourcompany.yourapp" } }

3.

配置你的 App Store Connect API 密钥

运行以下命令来配置你的 App Store Connect API 密钥:

Terminal
eas credentials --platform ios

该命令将提示你选择要配置的凭据类型。

  1. 选择 production 构建配置
  2. 使用你的 Apple 开发者账户登录并按照提示操作
  3. 选择 App Store Connect:管理你的 API 密钥
  4. 选择 设置你的项目以使用 API 密钥进行 EAS 提交
你想使用你自己的凭证吗?

App Store Connect API 密钥: 创建你自己的 API 密钥,然后在 eas.json 中使用 ascApiKeyPathascApiKeyIssuerIdascApiKeyId 字段进行设置。

应用专用密码: 通过在 eas.json 中分别使用 EXPO_APPLE_APP_SPECIFIC_PASSWORD 环境变量和 appleId 字段,提供你的 密码 和 Apple ID 用户名。

4.

在 eas.json 中提供提交配置文件

然后,你需要在 eas.json 中提供一个提交配置文件,其中包括以下字段:

eas.json
{ "submit": { "production": { "ios": { "ascAppId": "your-app-store-connect-app-id" } } } }
如何找到 ascAppId
  1. 登录 App Store Connect 并选择你的团队。
  2. 导航到 应用
  3. 点击你的应用。
  4. 确保 App Store 标签处于激活状态。
  5. 在左侧窗格的 常规 部分,选择 应用信息
  6. 你的应用的 ascAppId 可在 Apple ID 下的 一般信息 部分找到。

了解你可以在 eas.json 参考 中提供的所有选项。

5.

构建一个生产应用

你需要一个可用于商店提交的生产版本。你可以使用 EAS Build 创建一个。

Terminal
eas build --platform ios --profile production

或者,你可以在自己的电脑上使用 eas build --platform ios --profile production --local 或 Xcode 构建该应用。

完成所有先决条件后,你可以建立一个 CI/CD 流水线,将你的应用提交到 Apple App Store。

🌐 Once you have completed all the prerequisites, you can set up a CI/CD pipeline to submit your app to the Apple App Store.

使用 EAS Workflows CI/CD

🌐 Use EAS Workflows CI/CD

你可以使用 EAS Workflows 来自动构建和提交你的应用。

🌐 You can use EAS Workflows to build and submit your app automatically.

  1. 在项目根目录下创建一个名为 .eas/workflows/submit-ios.yml 的工作流程文件。

  2. submit-ios.yml 中,你可以使用以下工作流来启动提交 iOS 应用的任务:

    .eas/workflows/submit-ios.yml
    on: push: branches: ['main'] jobs: build_ios: name: Build iOS app type: build params: platform: ios profile: production submit_ios: name: Submit to TestFlight needs: [build_ios] type: testflight params: build_id: ${{ needs.build_ios.outputs.build_id }}

    上述工作流程将构建 iOS 应用,然后提交到 Apple App Store 的 TestFlight。你可以使用 testflight 任务与内部和外部测试组共享。有关更多信息,请参阅预打包的 testflight 任务

使用其他 CI/CD 服务

🌐 Use other CI/CD services

你可以使用其他 CI/CD 服务通过 EAS Submit 提交你的应用,例如 GitHub Actions、GitLab CI 等,只需运行以下命令即可:

🌐 You can use other CI/CD services to submit your app with EAS Submit, like GitHub Actions, GitLab CI, and more by running the following command:

Terminal
eas submit --platform ios --profile production

此命令需要使用 个人访问令牌 来验证你的 Expo 账户。获取令牌后,请在 CI/CD 服务中提供 EXPO_TOKEN 环境变量,这将允许 eas submit 命令运行。

🌐 This command requires a personal access token to authenticate with your Expo account. Once you have one, provide the EXPO_TOKEN environment variable in the CI/CD service, which will allow the eas submit command to run.

手动提交

🌐 Manual submissions

如果你需要在不使用 EAS Submit 的情况下提交你的构建,例如当该服务因维护暂时不可用时,你可以从 macOS 设备手动上传到 Apple App Store。

🌐 If you ever need to submit your build without going through EAS Submit, for example, if the service is temporarily unavailable for maintenance, you can upload to the Apple App Store manually from a macOS device.

如何从 macOS 设备手动上传到 Apple App Store

在 App Store Connect 上创建条目

🌐 Creating an entry on App Store Connect

如果你还没有创建应用资料,请先在 App Store Connect 中创建一个:

🌐 Start by creating an app profile in App Store Connect, if you haven't already:

  1. 前往 App Store Connect 并登录。确保你已接受页面顶部的任何法律通知或条款。
  2. 点击应用标题旁的蓝色加号按钮,然后点击 新建应用
  3. 添加你的应用名称、语言、打包标识符和 SKU(终端用户看不到此信息,它可以是任何唯一的字符串。常见的选择是你的应用打包标识符,例如“com.company.my-app”)。
  4. 点击 创建。如果成功,则表示你已创建了应用记录。

使用 Transporter 上传

🌐 Uploading with Transporter

最后,你需要将IPA上传到苹果应用商店。

🌐 Finally, you need to upload the IPA to the Apple App Store.

  1. 从 App Store 下载 Transporter
  2. 使用你的 Apple ID 登录。
  3. 可以通过将 IPA 文件直接拖入 Transporter 窗口,或通过 +添加应用 按钮打开的文件对话框中选择文件来添加构建。
  4. 点击 提交 按钮来提交它。

此过程可能需要几分钟,然后在苹果服务器上还需要额外 10-15 分钟的处理。之后,你可以在 App Store Connect 检查你的二进制文件状态:

🌐 This process can take a few minutes, then another 10-15 minutes of processing on Apple's servers. Afterward, you can check the status of your binary in App Store Connect:

  1. 访问 App Store Connect,选择 我的应用,然后点击你之前创建的应用条目。
  2. 向下滚动到构建部分,选择你新上传的二进制文件。