用途:在 iOS 模拟器或物理设备上构建、安装并测试 Expo/React Native 应用,适合自动化测试、TDD 循环与真机手工验证。
主要能力:先读取项目配置确定 Bundle ID(app.config.js/ts 或 app.json 的 expo.ios.bundleIdentifier)、EAS 构建 profile、Detox 配置、深链 scheme 与包管理器。提供两条路径:模拟器路径(npx expo prebuild --platform ios --clean、xcodebuild 构建、xcrun simctl install booted 安装、xcrun simctl launch booted <bundleId> 启动),并在原生代码、依赖或配置未变时跳过重建;真机路径支持 npx expo run:ios --device 有线安装,或 eas build --profile preview --platform ios 云构建,首次需 eas device:create 注册 UDID。内置 Detox 运行方式:npx detox test --configuration ios.sim.debug,可指定单文件,必要时用 npx detox build --configuration ios.sim.debug --if-missing 补建。另含测试实践(testID、动画页面禁用同步、深链进入测试页面)、截图命令 xcrun simctl io booted screenshot、失败取证与并行模拟器隔离(xcrun simctl create/boot/install/delete)。
限制与注意:Detox 需要 dev build 而非 Expo Go;模拟器不支持音频/媒体功能,需真机验证;iPad 与 iPhone 布局差异可能导致测试结果不同;EAS 云构建较慢且二维码会过期;npx expo run:ios --device 需 USB 连接且信任设备;Detox 在无模拟器运行时可能“假通过”;本地构建与 EAS 构建签名方式不同。具体版本、定价与平台支持资料未提供。