ios - Swift Github Action CocoaPods 构建失败,错误为 "Framework not found Pods_iosapp"

标签 ios swift cocoapods github-actions

我有一个简单的工作流定义来进行 Xcode 工作区构建和测试:

name: Swift iOS application
on: pull_request
jobs:
  test:
    name: Test
    runs-on: macOS-latest
    strategy:
        matrix:
          destination: ['platform=iOS Simulator,id=DEC5E859-67C9-4939-87A5-E749D824E541', 'platform=iOS Simulator,id=458AD46E-58ED-4016-875A-70965C6EC869']
    steps:
      - name: Checkout
        uses: actions/checkout@master
      - name: Build and Test
        run: |
          ls -al
          pod install --repo-update --clean-install
          ls -al
          echo "destination=${destination}"
          xcodebuild clean test -workspace iosapp.xcworkspace -scheme iosapp -destination "${destination}" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
        env:
         destination: ${{ matrix.destination }}


build 命令在我的笔记本电脑上本地成功,但在 Github Actions 运行时失败。这是更多的错误上下文:
Ditto /Users/runner/Library/Developer/Xcode/DerivedData/iosapp-emrlpxjejtcsbjdrjgmowfxebepf/Build/Products/Debug-iphonesimulator/iosapp.swiftmodule/i386-apple-ios-simulator.swiftdoc /Users/runner/Library/Developer/Xcode/DerivedData/iosapp-emrlpxjejtcsbjdrjgmowfxebepf/Build/Intermediates.noindex/iosapp.build/Debug-iphonesimulator/iosapp.build/Objects-normal/i386/iosapp.swiftdoc (in target 'iosapp' from project 'iosapp')
    cd /Users/runner/runners/2.165.2/work/ios-app/ios-app
    /usr/bin/ditto -rsrc /Users/runner/Library/Developer/Xcode/DerivedData/iosapp-emrlpxjejtcsbjdrjgmowfxebepf/Build/Intermediates.noindex/iosapp.build/Debug-iphonesimulator/iosapp.build/Objects-normal/i386/iosapp.swiftdoc /Users/runner/Library/Developer/Xcode/DerivedData/iosapp-emrlpxjejtcsbjdrjgmowfxebepf/Build/Products/Debug-iphonesimulator/iosapp.swiftmodule/i386-apple-ios-simulator.swiftdoc

Testing failed:

Test session results, code coverage, and logs:
    Command MergeSwiftModule failed with a nonzero exit code
    Framework not found Pods_iosapp
    Testing cancelled because the build failed.

** TEST FAILED **

最后这是我的 Podfile,没什么特别的:
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'

target 'iosapp' do
    pod 'BMSCore', '~> 2.6.0'
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for iosapp

  target 'iosappTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'iosappUITests' do
  inherit! :search_paths
  # Pods for testing
end

有谁明白为什么它会因这个错误而失败?

最佳答案

您需要将参数写在双引号下,例如:

xcodebuild clean test -workspace "iosapp.xcworkspace"

关于ios - Swift Github Action CocoaPods 构建失败,错误为 "Framework not found Pods_iosapp",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60455277/

相关文章:

javascript - iPhone : load local html in uiwebview via javascript

ios - AFNetworking错误-'无效的JSON写入类型(NSConcreteData)'-上传音频文件时

ios - 调整 UICollectionViewCell 的大小

ios - 与 Today 小部件共享 plist 文件

ios - 如何在主应用程序目标中使用单元测试用例(作为 test_spec 添加到开发 pod)?

ios - CocoaPods 安装失败(无法解析依赖)

ios - 消费者服务和开发者服务可以使用单独的 Apple ID 密码吗?

ios - firstRect(对于 :) returns wrong value in UITextField

ios - 如何检查 dataTaskWithRequest 是否完成?

ios - 使用未声明的类型 'UIWindowScene'