A module compiled using swift 3.0 cannot be imported into Swift 3.0.1

I upgraded Xcode to GM 8.1 and now get the error below for SwiftyJSON. Other imported structures seem to work. Is there a way to get this to work in Swift 3 until SwiftyJSON improves its structure? I used Carthage to import / update frameworks. I also tried changing Use Legacy Swift language version on. And off To no avail.

A module compiled with Swift 3.0 cannot be imported into Swift 3.0.1: Modules /SwiftyJSON.swiftmodule/arm64.swiftmodule

+81
swift swifty-json
25 Oct '16 at 21:54
source share
8 answers

SwiftyJson loading, precompiled carthage. Precompiled download with Swift Version 3.0. This makes the compiler complain that the version is incorrect. Using the following command:

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

SwiftyJson (and all other frameworks in Carthage) will be compiled locally using the local version of Swift (3.0.1), and the compiler will no longer complain.

+167
Oct 31 '16 at 9:33
source share

Remove the chache application from DerivedData and rebuild. the error can be fixed.

The DerivedData path is as follows:

 ~/Library/Developer/Xcode/DerivedData/ 
+18
Nov 07 '16 at 10:16
source share

Make sure you place the new Xcode 8.1 GM package in the Applications folder. We encountered this problem when one of us ran Carthage to update our dependencies, but did not replace the Xcode old 8.0 application in the application folder (8.1 GM escaped from the desktop).

You want to make sure that when starting in the terminal: xcrun swift -version , which returns Apple Swift version 3.0.1 .

+10
Oct 26 '16 at 4:45
source share

The default update of Xcode to a new one on the terminal worked for me.

Step 1: Use the following command to upgrade the version of Xcode to the latest version on the terminal. Link

 sudo xcode-select -switch <path/to/>Xcode.app 

Step 2: Now try the Carthage update command

 carthage update --platform iOS 
+9
Dec 21 '16 at 11:25
source share

Only for the latest updates:

Carthage released version 0.20 on February 27, 2017.

Carthage now only uses the pre-build binary if the available pre-build binary is compatible .

However, you no longer need to use: --no-use-binaries to avoid an incompatible pre-build structure.

So make sure you have a carthage version greater than 0.20 and just do:

 carthage update --platform iOS 
+8
Mar 28 '17 at 21:12
source share

Just like @zirinisp said:

  • You can use the following command: carthage update --platform iOS --no-use-binaries
  • Using the following command: xcrun swift -version to see the version of Swift
  • Do this: Xcode->preferences->locations to clear the received data and archive data, the most important thing is to change the command line tools to " Xcode 8.1 "
  • Using the following command: xcrun swift -version , you can see that the fast version is 3.0.1
  • Set Use Legacy Swift Language Version = NO

I hope this helps you

+5
Nov 22 '16 at 7:00
source share

I had exactly the same problem with the XCTest_Gherkin library, this worked for me:

  • ProductSchemeXCTest-Gherkin
  • ProductBuild

Hope this helps. I am using Cocoapods.

0
Nov 16 '16 at 7:43
source share

In Xcode Build Settings, make sure that the Angle Search Engines contain the appropriate Carthage Build folder:

 $(inherited) $(PROJECT_DIR)/Carthage/Build/iOS 
0
Apr 18 '17 at 17:20
source share



All Articles