ios - 我可以将 swift 版本降级到中度错误 'Module compiled with Swift x.x cannot be imported by the Swift x.x compiler' 吗?

标签 ios swift

我最近开始了我的第一个 swift 体验,但我遇到了一个错误

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

我认为只要在build设置中选择我的 swift 语言版本就可以缓和这个错误。但它不起作用。

enter image description here

经过几次搜索,我发现有两个选项

  1. 降级 Xcode
  2. 使用 swift 5.0 更新模块或重建模块

它们是我唯一的选择吗?我不知道为什么更改 swift 语言版本没有任何作用。

最佳答案

Xcode 10.2 自带的 swift 5 编译器可以在 swift 4 模式下编译。然而,它仍然是 swift 5 编译器,而不是 Xcode 10.1 中的 swift 4 编译器。 swift 5 编译器无法导入使用 swift 4 编译器构建的模块。

因此,您列出的两个选项是您仅有的选项。

关于ios - 我可以将 swift 版本降级到中度错误 'Module compiled with Swift x.x cannot be imported by the Swift x.x compiler' 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55822086/

相关文章:

swift - 通过使用函数参数类型来避免弱引用?

jquery - 按窗口大小隐藏和显示 div 元素

ios - Xamarin Forms 错误 - 'You MUST call Xamarin.Forms.Init(); prior to using it' - 仅限 TestFlight (iOS)

ios - UIWebView 的全部内容嵌入到 UITableView 中

ios - 如何不在 Xcode 输出中显示日志,但仍然将它们发送到 Hockeyapp 报告

ios - 如何在 iPhone 中使用以下 xml 数据解析数据

swift - Xcode 不接收 pod 更新

Swift:调用函数似乎令人困惑

ios - Swift firebase 快照在数据存在时返回 null

swift - 如何修复找不到 cocoapod .modulemap 文件