I’m using xCode 13.1 with macOS 12.0.1 Monterey. I added KingFisher
and removed it from my pod. but my project is not built anymore. I got this error for one of my local SDKs:
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.
What I’ve done but didn’t work:
pod deintegrate
andpod install
.- restart xCode with clearing cache and
DerivedData
. - checkout old branch and commit that worked before.
- moving code to another macBook that worked before.
- download, install and select toolchain 5.4 (odd errors appeared -> )
- changing swift compiler language of my target and project to swift 4 (It says you are using swift 5.5.1 again!)
- note that I didn’t update xcode or swift!
2
Answers
Taken from this Twitter thread.
You need to set the BUILD_LIBRARY_FOR_DISTRIBUTION build setting on the framework target
https://www.swift.org/blog/library-evolution/
https://developer.apple.com/videos/play/wwdc2019/416/
I fetch the same problem when I try to update a library. My Xcode version was
13.2
with the swift version5.5.2
. But the library I want to update required a swift versionof 5.7.0
. Using toolchains in Xcode might be the solution but I decided to update the Xcode version with the latest.I update my Xcode to the latest version
14.1
and the issue is resolved. Automatically the swift version is found on the latest Xcode.