29

使用 Carthage 管理我的依赖项,一切都在模拟器中运行良好。

但是,在为设备构建时,出现以下错误:

在此处输入图像描述

Module File was created by an older version of the compiler; rebuild Alamofire and try again: .../DerivedData/Build/Products/Debug-iPhones...

我已经尝试过其他人对类似问题的建议:删除我的派生数据,重新安装 Carthage 并重建框架。但是,错误一直存在。

4

3 回答 3

36

您使用的是正确版本的 xcodebuild 吗?当你运行 xcode-select -p 时你看到了什么?如果你想使用 Xcode 7 中的框架,它应该指向 Xcode 7。

删除所有派生数据rm -rf ~/Library/Developer/Xcode/DerivedData/ && carthage build

此外,当您carthage update 不使用 --no-use-binaries选项时,它会下载可能使用旧版本的 xcodebuild 构建的预构建框架。

另一种方法是使用carthage update --no-use-binaries. 这样,它将使用安装在 Mac 上的最新 Xcode 版本编译所有框架。

于 2016-04-16T08:13:00.597 回答
1

我正在使用 cocoapods。我只是右键单击错误的框架,在 Finder 中显示,删除它,然后再次构建项目,解决问题。

于 2016-11-17T02:59:40.003 回答
-1

您可以尝试通过命令行重建框架:

  • 打开终端
  • cd 项目/目录
  • 迦太基建造

然后清理xcode项目并运行!

于 2016-09-25T11:31:01.233 回答