Module compiled with Swift 4.0 cannot be imported in Swift 3.2.1

给你一囗甜甜゛ 提交于 2019-12-09 02:54:31

问题


Swift 4.0 modules were fine in Swift 3.2 apps with Xcode 9.0.

But now, with Xcode 9.1, I get:

Module compiled with Swift 4.0 cannot be imported in Swift 3.2.1

Or:

Module compiled with Swift 4.0 cannot be imported in Swift 4.0.1


回答1:


Swift 4.0 is compatible with Swift 3.2 only.
Swift 4.0.1 is compatible with Swift 3.2.1 only.

So:

  • you can't mix 4.0 and 3.2.1
  • you can't mix 4.0.1 and 3.2
  • you can't mix 4.0 and 4.0.1
  • you can't mix 3.2.1 and 3.2

To formulate it differently:

  • you can mix Xcode 9.0 supported Swift versions together
  • you can mix Xcode 9.1 supported Swift versions together
  • you can't mix Xcode 9.0 and Xcode 9.1 Swift versions

If the module was built by you, simply rebuild it with the same Xcode.
If the module was built by a third party, request an Xcode 9.1 compatible build.




回答2:


It's possible to build using Swift 3.2 in Xcode 9.1 beta 2 by installing the Xcode 9.0 toolchain and using that to build your project.

Then choose the Swift 4.0 release under the Xcode -> Toolchains menu.

You should now be able to build with either Swift 3.2 or 4.0 in Xcode 9.1 b2.




回答3:


Using the last Xcode version solved this issue



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

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