美文网首页
Xcode12打包SDK发布到cocoapods验证失败的解决方

Xcode12打包SDK发布到cocoapods验证失败的解决方

作者: Yancy_90 | 来源:发表于2021-03-08 15:11 被阅读0次
  • 错误信息如下
** BUILD FAILED **
The following build commands failed:
Ld /Users/xxx/Library/Developer/Xcode/DerivedData/
App-ffbcalrxowejfwejfwpfjwpoe/Build/Intermediate.noindex/App.build/
Release-iphonesimulator/App.build/Objects-normal/arm64/Binary/App normal arm64

My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.

The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.
s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.

The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

相关文章

网友评论

      本文标题:Xcode12打包SDK发布到cocoapods验证失败的解决方

      本文链接:https://www.haomeiwen.com/subject/vivpqltx.html