swift - 使用 swift 4.0 编译的模块无法导入到 swift 3.1 中 — Carthage

标签 swift xcode carthage xcode9-beta

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

用 swift 4.0 编译的模块无法在 swift 3.1 中导入

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

  • 删除了所有 Carthage buildcheckout
  • 已删除派生数据目录
  • 清理了项目
  • 运行迦太基更新

但是错误仍然存​​在。

迦太基

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

相关文章:

command-line - 显示来自 CLI 应用程序的通知

swift - 在 Swift 中结合 IF LET 和 OR

ios - Xcode 6.4 中的 MPPlayableContentManagerContext 错误

启用运行单元测试时出现 Xcode 服务 (Mavericks) 错误

ios - 如何从 CocoaPods 迁移到 Carthage?

ios - 动画按钮允许用户交互不起作用

ios - 是否有混合模式或其他我可以为 UIControls 设置的内容,以便我可以看到其下面的图层?

Xcode 和 Swift 更新后 iOS 图表不再工作

ios - 如何在我的 iOS 应用程序中调试 carthage(自有)依赖项?

objective-c - 如何通过 Carthage 在 Obj-C 项目中使用 Swift 库