【问题标题】:Module compiled with swift 4.0 cannot be imported in swift 3.1 — Carthageswift 4.0编译的模块不能导入swift 3.1——迦太基
【发布时间】:2018-01-09 02:03:11
【问题描述】:

我想使用 Xcode 9 beta 测试我的应用程序。现在我回到 Xcode 8 并且出现以下错误:

Module compiled with swift 4.0 cannot be imported in swift 3.1

为了解决这个错误,我刷新了所有 Carthage 构建并进行了一些清理:

  • 删除了所有迦太基buildcheckout
  • 删除了Derived Data 目录
  • 清理项目
  • 运行迦太基更新

但错误仍然存​​在。

迦太基

使用的命令是:'carthage update --platform iOS'

由于问题始终出在同一个框架上,DeviceKit 然后我设法将其从Cartfile 中删除。

项目构建然后显示错误,因为找不到DeviceKit。 然后我将它重新添加到Cartfile 并运行carthage update DeviceKit --platform iOS --no-use-binaries

错误再次出现。

这个相关问题带来了答案,但对于 Cocoapods:Module compiled with swift 4.0 cannot be imported in swift 3.1

【问题讨论】:

  • 具体是用什么命令让Carthage更新的?
  • carthage update --platform iOS
  • 也许可以试试carthage update NameOfTheLibrary --platform iOS --no-use-binaries。还要确保您已将命令行工具切换回 Xcode 8 版本:sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  • 已经这样做了。我更新了我的问题以添加这些步骤。
  • 我唯一的其他直接建议是使用TOOLCHAINS=com.apple.dt.toolchain.Swift_3_1 carthage bootstrap,如果这不起作用,也许删除/重新创建Cartfile.resolved

标签: swift xcode carthage xcode9-beta


【解决方案1】:

通过以下步骤解决:

  • 删除 Carthage 的一些派生数据:rm -rf ~/Library/Caches/org.carthage.CarthageKit/DerivedData
  • 为您的项目删除 Carthage 文件夹
  • 更新迦太基carthage update --platform iOS

我在 GitHub 上的专用 Carthage 页面上找到了答案:https://github.com/Carthage/Carthage/issues/2062

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-08
    • 2022-01-07
    • 2021-01-04
    • 1970-01-01
    • 1970-01-01
    • 2019-09-08
    • 2020-02-27
    相关资源
    最近更新 更多