【问题标题】:Swift Version Conflict: this SDK is not supported by the compiler, Please select a toolchain which matches the SDKSwift 版本冲突:编译器不支持此 SDK,请选择与 SDK 匹配的工具链
【发布时间】:2022-01-02 13:35:05
【问题描述】:

我将 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.

我做了什么但没用:

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

【问题讨论】:

    标签: swift xcode cocoapods conflict


    【解决方案1】:

    取自此 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?
    • @MahdiMoqadasi,你不能——除非你控制和构建那个 SDK。如果是不属于你的 3rd 方 SDK,你无法控制。
    • @TJOlsen 谢谢。你是对的。最后,我向开发团队报告,他们发布了更新版本。这不是我能解决的问题。
    • @MahdiMoqadasi 正确,但你做了你有能力做的事,所以我会在这里指出它以防它在未来帮助任何人 - 你向开发团队报告了这个问题负责使用中的SDK。对于未来的任何人 - 向有问题的 SDK 开发团队提交问题,并至少询问他们是否将 Build for Distribution 设置为 yes。这是一个很好的起点。
    猜你喜欢
    • 2022-07-21
    • 1970-01-01
    • 2018-11-03
    • 2015-01-12
    • 2017-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多