【发布时间】: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 构建并进行了一些清理:
- 删除了所有迦太基
build和checkout - 删除了
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