Module compiled with swift 3.0 cannot be imported in Swift 3.0.1

后端 未结 9 1506
执念已碎
执念已碎 2020-11-30 21:59

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 S

相关标签:
9条回答
  • 2020-11-30 22:35

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

    The DerivedData path like this:

    ~/Library/Developer/Xcode/DerivedData/
    
    0 讨论(0)
  • 2020-11-30 22:36

    Just to give the latest updates:

    Carthage has released version 0.20 on Feb 27, 2017.

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

    That is being said, you no longer have to use: --no-use-binaries to avoid incompatible pre-build framework.

    So make sure that you have carthage version greater than 0.20 and simply do:

    carthage update --platform iOS
    
    0 讨论(0)
  • 2020-11-30 22:42

    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.

    0 讨论(0)
  • 2020-11-30 22:42

    Just like @zirinisp said:

    1. You can Using the following command:carthage update --platform iOS --no-use-binaries
    2. Using the following command:xcrun swift -version to see the Swift version
    3. Do this: Xcode->preferences->locations to clear the derived data and archives data, the most important to change the command line tools to "Xcode 8.1"
    4. Using the following command:xcrun swift -version,you can see the swift version is 3.0.1
    5. Set Use Legacy Swift Language Version = NO

    I hope it will help you

    0 讨论(0)
  • 2020-11-30 22:42

    In Xcode Build Settings make sure your Framework Search Paths contain the appropriate Carthage Build folder:

    $(inherited)
    $(PROJECT_DIR)/Carthage/Build/iOS
    
    0 讨论(0)
  • 2020-11-30 22:43

    Updating default Xcode to new one on terminal worked for me.

    Step 1 : Use following command to update Xcode version to latest on Terminal. Ref

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

    Step 2 : Now try carthage update command

    carthage update --platform iOS
    
    0 讨论(0)
提交回复
热议问题