Dominique Vial
Dominique Vial

Reputation: 3969

Module compiled with swift 4.0 cannot be imported in swift 3.1 — Carthage

I wanted to test my app using Xcode 9 beta. Now I am back to Xcode 8 and I have the following error:

Module compiled with swift 4.0 cannot be imported in swift 3.1

To solve this error I refresh all Carthage build and made some cleaning:

But the error still here.

Carthage

The command used is: 'carthage update --platform iOS'

As the problem lie on always the same framework, DeviceKit I then manage to remove it from Cartfile.

Project build then show errors as DeviceKit is not found. I then re-add it to Cartfile and run carthage update DeviceKit --platform iOS --no-use-binaries

And the error re-appear.

This related question bring answer but for Cocoapods: Module compiled with swift 4.0 cannot be imported in swift 3.1

Upvotes: 2

Views: 1885

Answers (1)

Dominique Vial
Dominique Vial

Reputation: 3969

Solved by the following steps:

  • delete some Derived Data for Carthage: rm -rf ~/Library/Caches/org.carthage.CarthageKit/DerivedData
  • delete the Carthage folder for your project
  • Update Carthage: carthage update --platform iOS

I found the answer on the dedicated Carthage' page on GitHub: https://github.com/Carthage/Carthage/issues/2062

Upvotes: 4

Related Questions