Swift版本冲突:编译器不支持该SDK,请选择与SDK匹配的工具链

Mah*_*asi 20 xcode conflict cocoapods swift

我正在使用 xCode 13.1 和 macOS 12.0.1 Monterey。KingFisher我在我的 Pod 中添加和删除了它。但我的项目不再建立了。我的本地 SDK 之一收到此错误:

Failed to build module 'CbSdk';
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.4
(swiftlang-1205.0.26.9 clang-1205.0.19.55)', while this compiler is 'Apple Swift version 5.5.1 
(swiftlang-1300.0.31.4 clang-1300.0.29.6)'). Please select a toolchain which matches the SDK.
Run Code Online (Sandbox Code Playgroud)

我已经做了但没有成功的事情:

  • pod deintegratepod install
  • 重新启动 xCode 并清除缓存和DerivedData.
  • 签出以前有效的旧分支并提交。
  • 将代码移至另一台之前可以运行的 MacBook 上。
  • 下载、安装并选择工具链 5.4(出现奇怪的错误 -> )
  • 将我的目标和项目的 swift 编译器语言更改为 swift 4 (它表示您再次使用 swift 5.5.1!)
  • 请注意,我没有更新 xcode 或 swift!

पवन*_*पवन 8

摘自此 Twitter 帖子。

您需要在框架目标上设置 BUILD_LIBRARY_FOR_DISTRIBUTION 构建设置

https://www.swift.org/blog/library-evolution/

https://developer.apple.com/videos/play/wwdc2019/416/

在此输入图像描述

  • 如何更改本地添加的 SDK 的 BUILD_LIBRARY_FOR_DISTRIBUTION? (2认同)