我的团队最近开始使用 CocoaPods 来管理我们的 iOS 应用程序项目中的依赖关系。
这是 pod 文件:
platform :ios, '6.0'
pod "UI7Kit"
pod "AFNetworking", "~> 2.0"
pod "TMCache"
pod "SVProgressHUD"
pod "SVPullToRefresh"
然而,使用CocoaPods后,为iPhone 5构建目标总是失败,但在模拟器上成功。
这是错误日志:
ld: warning: ignoring file [DerivedData directory]/libPods.a, file was built for archive which is not the architecture being linked (armv7): [DerivedData directory]/libPods.a
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_SVProgressHUD", referenced from:
objc-class-ref in ....o
"_OBJC_CLASS_$_TMCache", referenced from:
objc-class-ref in ....o
"_OBJC_CLASS_$_UI7Kit", referenced from:
objc-class-ref in ....o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我已经尝试过中提到的解决方案CocoaPods 故障排除 http://guides.cocoapods.org/using/troubleshooting.html,包括添加Pods
静态库位于列表顶部,但它仍然失败。
后来我们发现,在“Pods Project Settings”>“Build Settings”>“Architectures”中,“Base SDK”设置为“No SDK (Latest OS X)”,“Build Active Architecture Only”>“Debug”设置为“是”并且“支持的平台”设置为“OS X”。将它们分别更改为“最新 iOS (iOS 7.0)”、“否”、“iOS”后,针对 iPhone 5 和模拟器的构建都工作正常。
然而,每次我们这样做Pod update
,所有三个设置都恢复到之前的状态,这很烦人。
我的问题是:
- 这是设计使然还是我的项目/工作区设置有问题?
- 如何防止这些设置恢复到错误的状态?
任何帮助将不胜感激。