使用 Carthage 管理我的依赖项,一切都在模拟器中运行良好。
但是,在为设备构建时出现以下错误:
Module File was created by an older version of the compiler; rebuild Alamofire and try again: .../DerivedData/Build/Products/Debug-iPhones...
我已经尝试过其他人对类似问题的建议:删除派生数据、重新安装 Carthage 并重建框架。但是,错误一直存在。
最佳答案
您使用的 xcodebuild 版本正确吗?当你运行 xcode-select -p 时你会看到什么?如果你想使用 Xcode 7 中的框架,应该指向 Xcode 7。
删除所有派生数据 rm -rf ~/Library/Developer/Xcode/DerivedData/&& carthage build
另外,当你使用 carthage update
without --no-use-binaries 选项时,它会下载可能使用旧版本 xcodebuild 构建的预构建框架.
另一种方法是使用 carthage update --no-use-binaries
。通过这种方式,它将使用您 Mac 上安装的最新 Xcode 版本编译所有框架。
关于ios - 模块文件是由旧版本的编译器创建的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36661635/