1.无论是执行pod install还是pod update都卡在了Analyzing dependencies 或者 Updating local specs repositories不动
解决: 原因在于当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:
[code]pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
2.pod 命令运行报下面错误
Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
解决: 不要使用文本编辑去编辑 Podfile ,使用Xcode编辑,或者使用终端敲命令去编辑。或者输入格式错误,没输入运行版本:
[code]platform:iOS, '7.0'
3.使用cocoapods导入第三方类库后头文件没有代码提示
解决: 选择Target -> Build Settings 菜单,找到\”User Header Search Paths\”设置项,新增一个值 "${SRCROOT}" ,并且选择\”Recursive\”
4.The dependency “ is not used in any concrete target.
解决: 这个错误是说明你没有使用下面的格式, 将 Podfile编辑成下面的格式
[code] platform :ios,'7.0'
target '你的app的target名字' do
pod 'AFNetworking', '2.0'
pod 'SDWebImage', '3.7'
...
end
5.安装错误
Setting up CocoaPods master repo
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master –depth=1
Cloning into ‘master’…
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
解决:
[code]$ git config --global http.postBuffer 24288000
$ git config --list
若输出 http.postbuffer=24288000, 就 OK了
6.在 pod install 时, 可以生成要导入的第三库, 但是其头文件找不到, 文件有缺失, target 设置没有完成.
[code] [!] The `Paopao [Debug]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [Release]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
解决: 产生此警告的原因是项目 Target 中的一些设置,CocoaPods 也做了默认的设置,如果两个设置结果不一致,就会造成问题。
我想要使用 CocoaPods 中的设置,分别在我的项目中定义 PODS_ROOT 和 Other Linker Flags 的地方,把他们的值用$(inherited)替换掉,进入终端,执行 pod update , 然后错误没了.
还有一种简单粗暴的方法:
点击项目文件 project.xcodeproj,右键显示包内容,用文本编辑器打开project.pbxproj,删除 OTHER_LDFLAGS 的地方,保存,执行
pod update
,错误没了
7.引用要导入的三方库缺少 .o 文件的错误
解决: 在Build Setting 中的Other Linker Flags选项中加入$(OTHER_LDFLAGS)
8.还有一个复杂些的错误, 在为新项目配置 cocoapods 时遇到的
[code]LoadError - dlopen(/Users/MyMac/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/x86_64-darwin14.1.0/psych.bundle, 9): Library not loaded: /usr/local/lib/libyaml-0.2.dylib
Referenced from: /Users/MyMac/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/x86_64-darwin14.1.0/psych.bundle
Reason: image not found - /Users/MyMac/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/x86_64-darwin14.1.0/psych.bundle
参考:
http://www.lai18.com/content/7728346.html
http://www.jianshu.com/p/b5315bf42975
http://www.cnblogs.com/Rinpe/p/5015753.html
http://www.lai18.com/content/7728346.html