Search code examples
iosxcodecarthage

How to recompile framework created using carthage with latest xcode version?


I created some frameworks on my own using Xcode 8.2.1 with Carthage package manager. When I try to use this framework in Xcode 8.3.3 I am getting the error below:

Module compiled with Swift 3.0.2 cannot be imported in Swift 3.1

I tried rebuilding the created framework using Xcode 8.3.3 and did carthage update in my existing project in which I am trying to use the framework. Still it throws the same error. Do I need to create the framework again using Xcode 8.3.3 in order to get rid of this error? Or is there a way to re-compile the existing framework?


Solution

  • The problem was my default Xcode selection path was set to Xcode 8.2.1.

    So every time I built the framework using carthage build --no-skip-current, it was building with Xcode 8.2.1.

    I changed my Xcode selection path to point to Xcode 8.3.3 by using the following command in Terminal:

    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer 
    

    Now the framework has been updated and I am able to access my framework in Xcode 8.3.3 without any issue.