Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler

appbootup picture appbootup · Mar 26, 2019 · Viewed 25.5k times · Source

I am trying to implement integration of third party app into project as per instruciton https://github.com/Paytm-Payments/Paytm_iOS_App_Kit/tree/master/Swift/BitCodeDisabled/PaytmNativeSDK

I see the following error in build

Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler

I have tried toolchains https://medium.com/xcblog/switching-swift-versions-inside-xcode-using-toolchains-755b28831c43 The error changes to Reason: Incompatible library version: PaytmNativeSDK requires version 1.0.0 or later, but libswiftCore.dylib provides version 0.0.0

How do i setup XCode or the Library to make it work . There is no chance of the vendor updating the library for Swift 5.0 and make it available on POD.

Answer

Mike Taverne picture Mike Taverne · Mar 26, 2019

For Carthage users: After upgrading to Xcode 10.2, I ran into this same issue with a framework that I had been importing using Carthage.

I resolved it by rebuilding the framework:

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