cocoa pods的问题收集

来源:互联网 发布:java读取dwg文件 编辑:程序博客网 时间:2024/05/19 15:41

一、云淡风轻的博客

1.CocoaPods 版本旧

The version of CocoaPods used to generate the lockfile is higher that the one of the current executable. Incompatibility issues might arise.

sudo gem update cocoapods

 

2.第一次 pod install 后,很完美,一切都正常,当删除掉部分配置文件(Pods.xcconfig)后,再重新 pod install 出现问题

“第三方类库无法引用”

Bing(Google 无法使用)了好半天,大致猜到问题出现在 Build Settings 的 Search Path 上,追加 "${SRCROOT}/Pods/xxx" 等,可以引用了。

问题:原来的 ${PODS_ROOT} 为什么失效了,找不到关于它的任何定义?

于是搜索 ${PODS_ROOT} 是哪里定义的,找到了答案:

Build Settings 中的 User-Defined(在最下方) 中,有一个定义 ${PODS_ROOT} = ${SRCROOT}/Pods。

 

3.恢复

创建了一个新的项目,项目的根目录 touch 一个 Podfile,vim 编辑一下,把需要导入的第三方类库写上,保存退出,执行 “pod install”,等待执行结束。

打开新生成的 xx.xcworkspace,观察新的项目的设置里有哪些新的变化。

首先,找到 ${PODS_ROOT},对比我之前的项目,项目中没有,看来是因为删除了那个文件后的操作使得这个定义没有被设置上。在这页顶部的搜索框左边,有个“+”模样的按钮,点击“Add User-Defined Setting,人工添加 ${PODS_ROOT} = ${SRCROOT}/Pods。

然后添加 Search Paths

 

切换到 Build Phases

照着新项目添加两个脚本“Check Pods Manifest.lock” 和 “Copy Pods Resources”

 

 

补充:

——————

运行后,仍然报了些关于“xxx 找不到”的错误,看了一眼 Pods.xcconfig 这个文件,发现我所在补救的事情在这里都写了,还差一个 Other Linker Flags 没有设置,复制粘贴到 Build Settings 中,再次运行,都好了。

CocoaPods 错误 target overrides the `OTHER_LDFLAGS`...

Xcode 升级到 6.0 后,更新 CocoaPods,出现了如下的警告

[!] 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 definedin `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

 警告没了,回到 Xcode,build通过。

网上还流行另外一种简单粗暴的方法

点击项目文件 project.xcodeproj,右键`显示包内容`,用文本编辑器打开`project.pbxproj`,删除`OTHER_LDFLAGS`的地方,保存,回到 Xcode,编译通过。


转自:http://www.cnblogs.com/ihojin/p/cocoapods-problems.html

2017.3.2更新

今天在写demo的时候,添加第三方库的时候出现了图下图的异常问题:

关于“out-of-date source repos which you can update with `pod repo update`”等的问题

上网搜集了一下资料,貌似是CocoaPods的版本库是有缓存的, 但在使用pod指令更新版本库时会出现冲突, 导致更新并不能如期完成, 需要手动删除本地缓存, 再进行更新.

更新的命令步骤是:

1.pod repo remove master

2.pod setup

pod setup的时间可能有点久,需要等待一段时间。这段时间不要关闭终端

等到终端出现

CocoaPods 1.2.0 is available.
To update use: `sudo gem install cocoapods`

就可以了。

0 0