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

npx testflight 命令

一个命令即可让你构建、签名并提交 iOS 应用到 TestFlight。


npx testflight 是一个命令行工具,可以引导你构建、签名并提交你的 iOS 应用到 TestFlight。

先决条件

3 要求

1.

一个 React Native iOS 项目

你希望部署到 TestFlight 的 React Native iOS 项目。

2.

苹果开发者账号

TestFlight 分发需要付费 Apple 开发者账户

3.

Expo 账户

如果你还没有,请注册一个 Expo 账户。

运行 npx testflight 命令

🌐 Run npx testflight command

在项目的根目录中运行以下命令:

🌐 Run the following command inside your project's root directory:

Terminal
npx testflight

该命令工作流程是交互式的,并使用最新的 EAS CLI 版本引导你完成以下提示:

🌐 The command workflow is interactive and walks you through the following prompts using the latest EAS CLI version:

  • 初始化或检测已关联的 EAS 项目。 如果你在新项目中运行此命令,CLI 将使用你的应用配置文件中的 slug 创建一个新的 EAS 项目。如果 CLI 检测到该项目已经在 EAS 上创建,它将继续使用相同的 slug。
  • 确认打包标识符。 如果你在新项目中运行此命令,可以输入新的标识符;对于后续命令运行,可以接受 CLI 检测到的标识符。向导还会询问你的应用是否使用标准或豁免加密。当此命令随后运行时,buildNumber 会自动递增。
  • 登录 Apple 开发者。 提供你的 Apple ID,完成双重身份验证,并允许命令行工具创建新的分发证书或使用现有的分发证书或描述文件。
  • 生成凭证。 如果 EAS 尚未为该应用包标识符管理凭证,CLI 将为你创建或更新分发证书和描述文件。
  • 创建生产构建。它使用默认的 EAS production 配置文件 开始 iOS 构建,以创建 iOS 存档文件(.ipa)。
  • 验证 App Store Connect 访问权限。 提交步骤会检查 App Store Connect API 密钥,如有需要会创建一个新的密钥。
  • 将应用提交到 TestFlight。 将生成的 .ipa 文件上传到 App Store Connect,并为团队的内部测试组启用 TestFlight 分发。

在整个过程中,你将在终端窗口中收到构建和提交状态更新。在 App Store Connect 仪表板中,你可以管理测试人员和分发。

🌐 You will receive build and submission status updates throughout the process inside the terminal window. Within the App Store Connect dashboard, you can manage testers and distribution.

注意:每个提示都反映了 EAS Build 和 EAS Submit 的流程,因此你可以像单独运行 eas build 或 eas submit 时一样进行回答。这意味着,在构建和提交过程中,EAS 仪表板将生成链接,你可以使用这些链接查看进度。提交过程成功完成后,你将获得 App Store Connect 的链接,你可以使用它查看你提交到 TestFlight 的内容。

为什么使用 npx testflight

🌐 Why use npx testflight

  • 节省开发者时间,无需单独的构建和提交步骤
  • 通过 EAS CLI 的引导提示处理 Apple 凭证、配置文件和 App Store Connect API 密钥
  • 生成一个新的构建并将其提交到 TestFlight,无需运行单独的命令
  • 在共享机器或安装全局软件包不方便的 CI 运行器上也能很好地工作

何时使用 npx testflight

🌐 When to use npx testflight

  • 从本地机器快速发送 TestFlight 版本
  • 触发一个或多个构建到 TestFlight,无需配置完整的 CI 工作流
  • 有内部测试小组,并希望尽快让你的应用中的最新更改可用
  • 让 EAS 自动处理证书、配置描述文件和 API 密钥

常见问题

🌐 Common question

我可以在非交互模式下运行 npx testflight 命令吗?

是的,当你在 eas.jsonsubmit.production 配置中提供 ascAppId 时,npx testflight 命令将跳过确保你的应用存在于 App Store Connect 的过程。

🌐 Yes, when you provide ascAppId in the submit.production profile in the eas.json, the npx testflight command will bypass the process of ensuring your app exists on App Store Connect.

eas.json
{ "submit": { "production": { "ios": { "ascAppId": "your-app-store-connect-app-id" } } } }

要了解如何找到你的 ascAppId,请参阅在提交到 Apple App Store 中的这些步骤

🌐 To learn more about how to find your ascAppId, see these steps in the Submit to the Apple App Store.