Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift Version Conflict: this SDK is not supported by the compiler, Please select a toolchain which matches the SDK

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 and pod 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!
like image 771
Mahdi Moqadasi Avatar asked Sep 05 '25 01:09

Mahdi Moqadasi


1 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/

enter image description here

like image 88
पवन Avatar answered Sep 07 '25 16:09

पवन



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!