昨天尝试新的swift ios项目, 基于swift2.1, 运行时发现缺少一些swift开源库,项目是基于carthage构建的,于是使用carthage update 命令下载开源库,结果下载完运行Xcode发现报CPU架构方面的错误,错误如下:
/Users/Documents/iOS/iOS-/Carthage/Checkouts/Alamofire/Source/Alamofire.h:23:9: error: could not build module 'Foundation'
<unknown>:0: error: could not build Objective-C module 'Alamofire'
A shell task failed with exit code 65:
** BUILD FAILED **
The following build commands failed:
CompileSwift normal arm64 /Users/Documents/iOS/iOS-/Carthage/Checkouts/Alamofire/Source/Upload.swift
CompileSwift normal arm64 /Users/Documents/iOS/iOS-/Carthage/Checkouts/Alamofire/Source/ParameterEncoding.swift
CompileSwift normal arm64 /Users/Documents/iOS/iOS-/Carthage/Checkouts/Alamofire/Source/Request.swift
CompileSwift normal arm64 /Users/Documents/iOS/iOS-/Carthage/Checkouts/Alamofire/Source/ResponseSerialization.swift
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(5 failures)
分析了原因,发现是carthage版本的问题,于是开始升级cartage,直接通过brew update carthage竟然不行,查看了官网的文档后,通过下面的升级步骤解决了问题,swift坑还是不少啊。
carthage verison
0.8
brew update
brew remove carthage
sudo rm -rf /Library/Frameworks/CarthageKit.framework
brew install carthage
carthage verison
0.11.0