我想使用 Xcode 9 beta 测试我的应用程序。现在我回到 Xcode 8,出现以下错误:
用 swift 4.0 编译的模块无法在 swift 3.1 中导入
为了解决此错误,我刷新了所有 Carthage 构建并进行了一些清理:
- 删除了所有 Carthage
build
和checkout
- 已删除
派生数据
目录 - 清理了项目
- 运行迦太基更新
但是错误仍然存在。
迦太基
使用的命令是:'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 的一些派生数据:
rm -rf ~/Library/Caches/org.carthage.CarthageKit/DerivedData
- 删除项目的 Carthage 文件夹
- 更新Carthage:
carthage update --platform iOS
我在 GitHub 上的专用 Carthage' 页面上找到了答案:https://github.com/Carthage/Carthage/issues/2062
关于swift - 使用 swift 4.0 编译的模块无法导入到 swift 3.1 中 — Carthage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45450781/