CocoaPods的安装和使用在以下两篇博客有详细介绍:
CocoaChina:使用CocoaPods管理依赖库
今天在下载了使用cocoaPods的一个工程,执行了 pod update,然后运行程序,报错:
The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
正确的做法是:
I. Project Cleanup
- In the project navigator, select your project
- Select your target
- Remove all libPods*.a in Linked Frameworks and Libraries
II. Update CocoaPods
- Launch Terminal and go to your project directory.
- Update CocoaPods using the command
- rm -rf MyProject.xcworkspace
- pod install
注意,1.3很重要。
执行pod install还是pod update都卡在Analyzing dependencies不动了,慢到无以复加的地步,无法忍受。
其实原因在于以上两个命令执行时会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
</pre><pre name="code" class="html">
最后点击 appName.xcworkspace 启动程序