xcode 无法在 Swift X.0.2 中导入使用 swift X.1 编译的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43238856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:53:13  来源:igfitidea点击:

Module compiled with swift X.1 cannot be imported in Swift X.0.2

swiftxcodeswift3

提问by etayluz

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

Swift 3.1 出来了,我在我的项目中收到此错误消息:

Module compiled with swift 3.1 cannot be imported in Swift 3.0.2

无法在 Swift 3.0.2 中导入使用 swift 3.1 编译的模块

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

那么我如何告诉 Xcode 开始更新我的项目并将其迁移到 Swift 3.1?

回答by Mozahler

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

您很可能包含了 3rd 方框架/库。这些是需要更新/重新编译的内容。如果您使用 Carthage 或 Pods,您应该重建这些库并使它们可用于您的应用程序。问题不在于您的代码。当你编译它时,它会编译为 3.1

回答by VitDuck

etayluz

埃塔鲁兹

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

将您的 Xcode 升级到 8.3,您的 Swift 版本将是 3.1

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

我使用 Carthage 再次更新库/框架,使用选项--no-use-binaries

carthage update --no-use-binaries

回答by iPhoneDeveloper

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.

当您的 Xcode 不支持特定版本的第三方依赖项时,有时会发生这些事情。尝试使用与 Xcode 版本兼容的第三方依赖项的正确版本。

  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-binariesin your terminal. Gets rid of compatibility issues.
  3. Clean your project. Command + Shift + K. Then build and run.
  1. 清除 Xcode 中的派生数据。Xcode -> File -> Workspace settings -> 单击 Derived data 旁边的灰色箭头标记。
  2. 通过运行检查迦太基版本carthage version。它应该在 0.20.0 以上。carthage update --platform iOS --no-use-binaries在您的终端中运行。摆脱兼容性问题。
  3. 清理你的项目。Command + Shift + K。然后构建并运行。