CircleCI构建失败:iOS单元测试无法在抽象设备运行求助
修复方案
问题根源
你的config.yml存在YAML缩进错误:Build and Test的run步骤没有被包含在build job的steps列表中,导致CircleCI执行时未使用你指定的模拟器目标,而是默认尝试在"Any iOS Device"上运行测试,触发了错误。
修正后的配置文件
将Build and Test步骤缩进,放入build job的steps内部:
version: 2.1 jobs: build: macos: xcode: "15.2.0" steps: - checkout # Install dependencies if needed # - run: # name: Install Dependencies # command: | # # Your dependency installation commands go here - run: name: Build and Test command: | xcodebuild clean test -project CircleCISampleProject.xcodeproj -scheme CircleCISampleProject -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' CODE_SIGNING_REQUIRED=NO workflows: version: 2 build: jobs: - build
额外验证步骤(可选)
如果修正后仍有问题,可以在Build and Test步骤前添加一个命令,查看CircleCI环境中可用的模拟器列表,确保你指定的设备名称存在:
- run: name: List Available Simulators command: xcrun simctl list devices
内容的提问来源于stack exchange,提问作者Abhistin
相关产品推荐
相关产品推荐

