Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module compiled with swift 3.0 cannot be imported in Swift 3.0.1

I upgraded Xcode to 8.1 GM and am now getting the below error for SwiftyJSON. Other imported frameworks seem to work. Is there a way to force this to work in Swift 3 until SwiftyJSON upgrades their framework? I used Carthage to import/update frameworks. I also tried changing Use Legacy Swift language version On and Off to no avail.

Module compiled with Swift 3.0 cannot be imported in Swift 3.0.1: Modules/SwiftyJSON.swiftmodule/arm64.swiftmodule

like image 828
HH887 Avatar asked Oct 25 '16 21:10

HH887


2 Answers

SwiftyJson is being downloaded precompiled by carthage. The precompiled download is with Swift Version 3.0. That makes the compiler complain that the version is not correct. Using the following command:

carthage update --platform iOS --no-use-binaries 

SwiftyJson (and all other frameworks within Carthage) will be compiled locally using the local version of Swift (3.0.1) and the compiler will not complain anymore.

like image 132
zirinisp Avatar answered Sep 27 '22 21:09

zirinisp


Remove the app chache from DerivedData, and rebuild. the error may be fixed.

The DerivedData path like this:

~/Library/Developer/Xcode/DerivedData/ 
like image 23
i-chou Avatar answered Sep 27 '22 19:09

i-chou