Module compiled with swift 3.1 cannot be imported in Swift 3.0.2

你离开我真会死。 提交于 2019-12-10 13:44:46

问题


Swift 3.1 came out and I'm receiving this error message in my project:

Module compiled with swift 3.1 cannot be imported in Swift 3.0.2

So how do I tell Xcode to start updating my project and migrate it to Swift 3.1?


回答1:


It is likely that you are including 3rd party frameworks/libraries. Those are what need to be updated/recompiled. If you are using Carthage or Pods you should just rebuild those libraries and make them available to your app. The problem isn't your code. When you compile it, it will compile to 3.1




回答2:


etayluz

Upgrade your Xcode to 8.3 and your Swift version will be 3.1

I use Carthage to update library/framework again, with option --no-use-binaries

carthage update --no-use-binaries



回答3:


These steps helped me.

These things happens sometimes when your Xcode doesn't support certain version of your third party dependencies. Try to use proper version of your third party dependencies compatible with Xcode version.

  1. Clear your Derived data in Xcode. Xcode -> File -> Workspace settings -> Click on the grey arrow mark beside Derived data.
  2. Check carthage version by running carthage version. It should be above 0.20.0. Run carthage update --platform iOS --no-use-binaries in your terminal. Gets rid of compatibility issues.
  3. Clean your project. Command + Shift + K. Then build and run.


来源:https://stackoverflow.com/questions/43238856/module-compiled-with-swift-3-1-cannot-be-imported-in-swift-3-0-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!