xcode 为什么GitHub Action仍然使用iOS 16.2模拟器,尽管我设置了版本16.0?

p8ekf7hl  于 2023-02-25  发布在  Git
关注(0)|答案(1)|浏览(247)

我们最近不得不将iOS部署目标从16.2降级到16.0。我们的GitHub Action工作流以及XCode项目设置更改如下:

    • 完整的工作流配置**
name: "Pull Request CI/CD"
on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  build:
    runs-on: macos-12

    steps:
      - name: Checkout Project
        uses: actions/checkout@v3

      - name: Setup Mac OS build environment
        run: |
          defaults write com.apple.iphonesimulator CarPlay -bool NO

      - name: Show the currently detailed version of Xcode for CLI
        run: xcode-select -p

      - name: Show Build Settings for app
        run: xcodebuild -project bev.xcodeproj -scheme 'bev' -showBuildSettings

      - name: Show Build SDK for app
        run: xcodebuild -project bev.xcodeproj -scheme 'bev' -showsdks

      - name: Show Available Destinations for app
        run: xcodebuild -project bev.xcodeproj -scheme 'bev' -showdestinations

      - name: Build
        run: xcodebuild clean build -project bev.xcodeproj -scheme 'bev' -destination 'platform=iOS Simulator,OS=16.0,name=iPhone 14' -showBuildTimingSummary

      - name: Run test target for app
        run: xcodebuild clean test -project bev.xcodeproj -scheme 'bev' -destination 'platform=iOS Simulator,OS=16.0,name=iPhone 14' -showBuildTimingSummary

当运行工作流程时,我们现在突然收到下面的错误消息。在更改之前,这通常工作正常。真正奇怪的是,GitHub找不到iOS 16.0模拟器,因此抱怨没有可用的。
如何解决这个问题?

    • 来自GitHub操作工作流的错误消息**
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
        { platform:iOS Simulator, OS:16.0, name:iPhone 14 }

    The requested device could not be found because no available devices matched the request.

    Available destinations for the "bev" scheme:
        { platform:iOS, name:Any iOS Device }
        { platform:iOS Simulator, name:Any iOS Simulator Device }
        { platform:iOS Simulator, OS:16.2, name:iPad (9th generation) }
        { platform:iOS Simulator, OS:16.2, name:iPad (10th generation) }
        { platform:iOS Simulator, OS:16.2, name:iPad Air (4th generation) }
        { platform:iOS Simulator, OS:16.2, name:iPad Air (5th generation) }
        { platform:iOS Simulator, OS:16.2, name:iPad Pro (9.7-inch) }
        { platform:iOS Simulator, OS:16.2, name:iPad Pro (11-inch) (3rd generation) }
        { platform:iOS Simulator, OS:16.2, name:iPad Pro (11-inch) (4th generation) }
        { platform:iOS Simulator, OS:16.2, name:iPad Pro (12.9-inch) (5th generation) }
        { platform:iOS Simulator, OS:16.2, name:iPad Pro (12.9-inch) (6th generation) }
        { platform:iOS Simulator, OS:16.2, name:iPad mini (6th generation) }
        { platform:iOS Simulator, OS:16.2, name:iPhone 8 }
        { platform:iOS Simulator, OS:16.2, name:iPhone 8 Plus }
        { platform:iOS Simulator, OS:16.2, name:iPhone 11 }
        { platform:iOS Simulator, OS:16.2, name:iPhone 11 Pro }
        { platform:iOS Simulator, OS:16.2, name:iPhone 11 Pro Max }
        { platform:iOS Simulator, OS:16.2, name:iPhone 12 }
        { platform:iOS Simulator, OS:16.2, name:iPhone 12 Pro }
        { platform:iOS Simulator, OS:16.2, name:iPhone 12 Pro Max }
        { platform:iOS Simulator, OS:16.2, name:iPhone 12 mini }
        { platform:iOS Simulator, OS:16.2, name:iPhone 13 }
        { platform:iOS Simulator, OS:16.2, name:iPhone 13 Pro }
        { platform:iOS Simulator, OS:16.2, name:iPhone 13 Pro Max }
        { platform:iOS Simulator, OS:16.2, name:iPhone 13 mini }
        { platform:iOS Simulator, OS:16.2, name:iPhone 14 }
        { platform:iOS Simulator, OS:16.2, name:iPhone 14 Plus }
        { platform:iOS Simulator, OS:16.2, name:iPhone 14 Pro }
        { platform:iOS Simulator, OS:16.2, name:iPhone 14 Pro Max }
        { platform:iOS Simulator, OS:16.2, name:iPhone SE (2nd generation) }
        { platform:iOS Simulator, OS:16.2, name:iPhone SE (3rd generation) }
nvbavucw

nvbavucw1#

错误的原因是管道使用的是XCode 14.2,它没有随附iOS 16.0的模拟器。然而,根据苹果公司的说法,XCode 14.0.x内置了iOS 16.0。因此,解决方案是调整GitHub Action如下:

之前

- name: Show the currently detailed version of Xcode for CLI
  run: xcode-select -p

之后

- name: Show the currently detailed version of Xcode for CLI
  run: sudo xcode-select -switch /Applications/Xcode_14.0.1.app

相关问题