使用swift 4.0编译的模块无法在swift 3.1中导入 - 迦太基

时间:2017-08-02 03:06:23

标签: swift xcode carthage xcode9-beta

我想使用Xcode 9 beta测试我的应用。现在我回到Xcode 8,我有以下错误:

Module compiled with swift 4.0 cannot be imported in swift 3.1

要解决此错误,我刷新所有迦太基构建并进行一些清理:

  • 删除了所有Carthage buildcheckout
  • 已移除Derived Data目录
  • 清理项目
  • 运行carthage update

但错误仍然存​​在。

迦太基

使用的命令是:'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

1 个答案:

答案 0 :(得分:4)

通过以下步骤解决:

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

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