0

I updated the Usabilla SDK in the app to the latest version in terminal. After running the app I received this error:

Module compiled with Swift 4.1 cannot be imported in Swift 3.2.3

when I import the following in my application:

import Usabilla 

Please provide the detailed steps to resolve.

picciano
  • 22,341
  • 9
  • 69
  • 82
  • Have you updated Xcode? – Pranav Kasetti May 17 '18 at 18:37
  • 2
    Why are you using Swift 3.2.3 instead of Swift 4 anyways? – Dávid Pásztor May 17 '18 at 18:38
  • 1
    Added a "helpful" to @David_Pasztor comment. In addition, you should understand the history of Swift versioning - particularly the timing. In just over two weeks, it's *very* likely that Apple will announce (immediately available in beta and in production come September) both Xcode 10 and Swift 5. A *bit* less likely is the chance that Xcode 10 will not support any version of Swift 3. If you program using Swift, something you need to add to your task list is spending June-September upgrading to the latest release of Swift. (Fortunately the worst is over - porting Swift 2 to 3 was painful.) –  May 17 '18 at 19:02

2 Answers2

3

Swift does not yet offer binary compatibility. This means that all Swift code used in a project must be compiled with the same version of Swift.

Your options are:

  1. Find a version of the SDK that is compiled with the version of Swift you need,
  2. Bring the source code of the SDK into your project and compile it there, or
  3. Update your project to Swift 4.1 and use the latest version of Xcode.

Option 3 is my recommendation, if possible.

picciano
  • 22,341
  • 9
  • 69
  • 82
  • I faced the exact same scenario. Somehow as per requirement I could update to Swift latest version. So I followed the other option mentioned. – Nitish May 17 '18 at 18:52
0

You should upgrade your version of Xcode, get the latest version of it here Swift is not yet reverse-compatible, that is why you see the error.

FullMetalFist
  • 208
  • 1
  • 2
  • 14