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

使用 EAS Submit 提交到 Apple App Store

了解如何使用 EAS Submit 将你的 iOS 应用提交到苹果 App Store。


EAS 提交 是将你的 iOS 应用上传到 Apple App Store 的推荐方式。eas submit 命令在你的电脑上和 CI/CD 环境里都能一样使用。EAS 工作流 是在构建后自动运行它的最简单方式。EAS 提交支持 macOS、Linux 和 Windows,所以你不需要 Mac 也能发布 iOS 构建。

先决条件

🌐 Prerequisites

先决条件

3 要求

1.

注册 Apple 开发者账户

提交应用到 Apple App Store 需要一个付费的 Apple 开发者账户。在 Apple Developer 门户 注册。

2.

在应用配置中包含一个包标识符

在 app.json 中包含你的应用包标识符(bundle identifier):

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

3.

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

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

Terminal
- npm install --global eas-cli && eas login
- yarn global add eas-cli && eas login
- pnpm add --global eas-cli && eas login
- bun add --global eas-cli && eas login

构建一个生产应用

🌐 Build a production app

你需要一个用于提交的生产 .ipa 文件。用 EAS Build 创建一个吧:

🌐 You need a production .ipa to submit. Create one with EAS Build:

Terminal
- eas build --platform ios --profile production

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

🌐 Alternatively, build on your own computer with eas build --platform ios --profile production --local or with Xcode.

使用 eas submit 提交

🌐 Submit with eas submit

一旦构建完成,就把它提交到苹果应用商店:

🌐 Once the build is ready, submit it to the Apple App Store:

Terminal
- eas submit --platform ios

这个命令会引导你选择一个构建版本,首次运行时提示输入你的 Apple ID,并将二进制文件上传到 App Store Connect。处理完成后(通常需要 10-15 分钟),构建版本会出现在 TestFlight 中。要发布到正式版,登录 App Store Connect 并提交构建进行应用审核即可。

🌐 The command will walk you through selecting a build, prompt for your Apple ID on first run, and upload the binary to App Store Connect. The build appears in TestFlight after processing (usually 10-15 minutes). To release to production, log in to App Store Connect and submit the build for App Review.

配置提交配置文件

🌐 Configure a submission profile

在 eas.json 中添加一个提交配置文件,使用你的 App Store Connect 应用 ID:

🌐 Add a submission profile in eas.json with your App Store Connect app ID:

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 参考 了解所有可用选项。

🌐 See the eas.json reference for every available option.

一步构建并提交

🌐 Build and submit in one step

把 --auto-submit 传给 eas build,让 EAS Submit 自动接收完成的构建:

🌐 Pass --auto-submit to eas build to hand the finished build off to EAS Submit automatically:

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

详情请参见 自动提交。

🌐 See Automate submissions for details.

使用 EAS 工作流程实现自动化

🌐 Automate with EAS Workflows

EAS 工作流 会在 EAS 基础设施上运行相同的提交步骤,可以通过 git push 触发,也可以从命令行手动运行。首先,配置一个 App Store Connect API 密钥,这样工作流就可以与 Apple 非交互式地进行身份验证:

Terminal
- eas credentials --platform ios
  1. 选择 production 构建配置文件。
  2. 使用你的 Apple 开发者账号登录并按照提示操作。
  3. 选择 App Store Connect:管理你的 API 密钥。
  4. 选择 设置你的项目以使用 EAS Submit 的 API 密钥。
你想自己带凭证吗?

App Store Connect API 密钥: 创建你自己的 API 密钥 并在 eas.json 中使用 ascApiKeyPath、ascApiKeyIssuerId 和 ascApiKeyId 字段进行设置。

应用专用密码: 通过 EXPO_APPLE_APP_SPECIFIC_PASSWORD 环境变量提供你的 应用专用密码,并在 eas.json 中使用 appleId 字段设置你的 Apple ID。

创建一个名为 .eas/workflows/submit-ios.yml 的工作流文件,内容如下:

🌐 Create a workflow file named .eas/workflows/submit-ios.yml with the following contents:

.eas/workflows/submit-ios.yml
name: Submit iOS 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 }}

每次推送到 main 时,这会构建一个 iOS 应用并提交到 TestFlight。预打包的 testflight 工作 也可以将构建分享给内部和外部测试组。可以手动触发工作流:

🌐 This builds an iOS app on every push to main and submits it to TestFlight. The pre-packaged testflight job can also share the build with internal and external testing groups. Trigger the workflow manually with:

Terminal
- eas workflow:run submit-ios.yml

查看更多模式,请参考工作流示例指南。

🌐 See the workflow examples guide for more patterns.

使用其他 CI/CD 服务

🌐 Use other CI/CD services

你可以在任何 CI/CD 服务上运行 eas submit,比如 GitHub Actions、GitLab CI 等等:

🌐 You can run eas submit from any CI/CD service, such as GitHub Actions, GitLab CI, and others:

Terminal
- eas submit --platform ios --profile production

这需要一个 个人访问令牌 来验证你的 Expo 账户。在你的 CI 服务中设置 EXPO_TOKEN 环境变量,这样 eas submit 就可以非交互式运行了。

🌐 This requires a personal access token to authenticate with your Expo account. Set the EXPO_TOKEN environment variable in your CI service so eas submit can run non-interactively.

手动回退

🌐 Manual fallback

如果 EAS Submit 暂时不可用,你可以在带有 Xcode 的 Mac 上手动上传到 Apple App Store。

🌐 If EAS Submit is temporarily unavailable, you can upload to the Apple App Store manually from a Mac with Xcode.

用 Xcode 手动提交 iOS 应用

在 macOS 上使用 Xcode 打包并上传 iOS 应用到 App Store Connect。