【问题标题】:Module compiled with Swift 4.2 cannot be imported by the Swift 5.0.1 compiler [duplicate]Swift 5.0.1 编译器无法导入使用 Swift 4.2 编译的模块 [重复]
【发布时间】:2019-06-15 21:30:53
【问题描述】:

我的项目正在使用 Xcode 10.1,但是当我尝试使用 Xcode 10.2.1 时,我遇到了这个问题:

"使用 Swift 4.2 编译的模块不能被 Swift 5.0.1 编译器导入:/xxx/xxx/xxx/xxx/xxx/xxx/xxx.framework/Modules/xxx.swiftmodule/i386.swiftmodule"

"使用 Swift 4.2 编译的模块不能被 Swift 5.0.1 编译器导入:/xxx/xxx/xxx/xxx/xxx/xxx/xxx.framework/Modules/xxx.swiftmodule/x86_64.swiftmodule"

我收到了有关我正在使用的嵌入式框架的问题。当我检查相同的问题时,我在互联网上没有找到任何解决方案。你们有什么想法吗?

谢谢。

【问题讨论】:

  • 您的嵌入式框架必须重新编译。另请注意,在 Xcode 11 之后,我们不会再遇到此类问题,因为在传入的 ABI 稳定性之前。

标签: ios xcode swift4 swift5


【解决方案1】:

您必须使用Clean All -> Build 使用相同版本的编译器重新编译所有依赖项。 如果您同时安装了两个版本,请确保 Locations -> Command Line Tools 设置为最新的 Xcode 10.2.1。

【讨论】:

    【解决方案2】:

    我知道这是一个外部模块/框架。

    如果您无权访问源文件,那么您需要请求供应商更新框架,即使用 Swift 5 编译它。

    如果这不可能,那么您需要将您的项目保留在 Swift 4.2 上,直到进一步...

    干杯!

    【讨论】:

      【解决方案3】:

      从构建设置更改您的 Swift 语言版本。

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

      希望这会奏效。

      【讨论】:

        猜你喜欢
        • 2020-01-27
        • 2019-02-24
        • 2021-09-26
        • 2019-08-17
        • 1970-01-01
        • 1970-01-01
        • 2019-03-11
        • 2019-03-15
        相关资源
        最近更新 更多