Module compiled with Swift 4.0 cannot be imported in Swift 4.0.1

前端 未结 8 962
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 18:58

However I have recompiled the framework using the same Xcode and it still gives me this error.

  • Base SDK iOS 11.1 for both
  • Swift Language Version Swi
8条回答
  •  醉梦人生
    2020-11-29 19:25

    I hit this issue with Xcode 10 beta, which adds Swift 4.2. My issue was unrelated to Carthage or any external dependencies.

    Go to YourTarget > Build Settings > Swift Language Version for all of your Xcode targets.

    Mine were all set to Swift 4.

    After adding a Copy Files Build Phase, I started getting the error

    :0: error: module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 compiler: /Users/user/Library/Developer/Xcode/DerivedData/MyApp-faskfrihumfcdibjxisjvbfshppp/Build/Intermediates.noindex/MyApp.build/Debug/MyAppExtension.build/Objects-normal/x86_64/MyClass~partial.swiftmodule

    Command MergeSwiftModule failed with a nonzero exit code

    I then set each target's Swift Language Version to Swift 4.2, which eliminated the error.

    I'm not sure why the error was occuring in the first place, though, as having all targets set to Swift 4 should be equally as valid.

提交回复
热议问题