问题1

pod的时候可能会遇到libwebp v0.6.0 超时问题,
解决方案:

直接进入到/Users/(你本地的名字)/.cocoapods/repos/master/Specs/1/9/2/libwebp ,选择0.6.0文件夹把里面的libwebp.podspec.json打开,修改里面的git地址为 https://github.com/webmproject/libwebp.git 就可以了。

问题2

[!] Unable to find a specification for FMDB depended upon by MCLib
原因:Podfile 在私有库后面配置了 source,没有考虑到私有库 A 依赖的私有库 B,而私有库 B 依赖 FMDB, 在设置的 source 中找不到 FMDB。

解决1:

source 'https://github.com/CocoaPods/Specs.git'

解决2:

 pod 'A' , '0.0.1' , :source => 'git@10.2.250.21:MCLib/specRepo_iOS.git'

问题3

None of your spec sources contain a spec satisfying the dependency: MySpecialIndexRepository (~> 7.0.0).

解决方法:

pod install --repo-update

问题4

[!] CocoaPods could not find compatible versions for pod "TestPodSourceLayered":
In Podfile:
xxx
Specs satisfying the TestPodSourceLayered dependency were found, but they required a higher minimum deployment target.

解决方法:
原因是你要pod install的profile 文件 支持的部署最低版本 小于它依赖xxx支持的最低的部署版本,将当前要pod install 工程的 platform :ios, 'n',n大于等于xxx库的最低部署版本即可

问题5

[!] The repo xxx at ../../../../../.cocoapods/repos/TALComponentTest-Spec is not clean
解决方法:

step 1: 移除本地私有索引库:pod repo remove xxx
step 2 : 添加本地私有索引库:pod repo add xxx  https://gitee.com/?.git
3》添加本地podspec文件到远程私有索引库即可:pod repo push xxx (要推送的私有库).podspec --allow-warnings

私有库依赖公开库例如SDWebImage或者其他自己公司的私有库 ,导致pod lib lint 或者 pod spec lint一直失败

  • ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for TestPodSourceLayered depended upon by TestModule
    解决方法:
    原因是如果其他其他的库,执行校验,如果不指定其他库的spec地址(就是其他库podspec对应spec repo 索引库地址),它会去cocoapods master去去找,所以报错
远程验证:
 pod spec lint --sources='https://github.com/github名字/xxx.git,https://github.com/CocoaPods/Specs.git' --verbose  

本地验证:
pod spec lint --sources='https://github.com/github名字/xxx.git,https://github.com/CocoaPods/Specs.git' --verbose  

推送的话:
pod repo push 本地私有库名字 xxx.podspec --sources='https://github.com/github名字/xxx.git,https://github.com/CocoaPods/Specs.git' --verbose

问题6

[!] Unable to find a specification for xxx depended upon by TestModuleB
解决方案:

没有在podfile里添加source源导致 ,加入xxx对应的spec repo 地址即可,注意是spec索引库的地址

问题7

Specs satisfying the xxx (from../) dependency were found, but they required a higher minimum deployment target.
解决方案:

原因你依赖的xxx库的部署最低版本大于你的podfile中的最低部署版本,一种你修改podfile的部署版本大于等于xxx的最低部署库版本;如果你有xxx库的修改权限,还有一种方式就是你修改xxx的最低部署版本,小于等于你的podfile的最低部署版本 ;

问题 8

pod spec lint- ERROR | [iOS] [xxx] file patterns: The source_files pattern did not match any file.
解决方案:

是xxx对应的路径不对,需要是podspec同级为准,依次类推即可

问题9

  • ERROR | [iOS] file patterns: The vendored_libraries pattern did not match any file.
    解决方案:
第一步:检测看看是不是自己的路径错误,所有的路径都要基于Pod名字那一层级也就是podspec文件同级开始,依次类推;
第二步:如果第一步确定不是路径问题,看看提示的文件是不是被.gitignore文件设置为忽略文件啦,我的引入了.a文件,pod spec文件远程校验一直不通过,但是pod lib 一直没问题,我就猜测远程pod repo 没有该文件导致,一看远程仓库确实没有,没有的话肯定是被忽略啦,这是我看了工程忽略没有忽略,看了全局确实忽略了所有的 *.a文件,被坑一下

问题10

[!] Unable to find a pod with name, author, summary, or description matching xxx
解决方案:
一般情况下,执行完pod repo push ,需要等待1小时才可以搜索到,但是我们都是急性子,解决方法如下

第一步执行: rm -rf ~/Library/Caches/Cocoapods
第二步执行:重新执行 pod search xxx 或者 直接 pod install --repo-updat 即可

问题11

pod lab lint 报错 - NOTE | [iOS] xcodebuild: warning: The iOS Simulator deployment target 'IPHONEOS_DE

解决方法:验证后面加上 --skip-import-validation

其他问题整合

[其他收集cocoapods 常见错误对应的解决方法 ] (http://www.mengyueping.com/2018/08/16/iOS_CocoaPods_03/
)

问题12

问题描述:

//问题1:警告第三方库或者文件和xcode 的 build setting设置的framework搜索路径重复啦
[!] The TALStreamDemo [Debug] target overrides the FRAMEWORK_SEARCH_PATHS >build setting defined in `Pods/Target Support Files/Pods-TALStreamDemo/Pods->TALStreamDemo.debug.xcconfig'. This can lead to problems with the CocoaPods installation

解决步骤:

step1: 打开项目 Target - Build Settings ,搜索 Other Linker Flags ,在这个设置上加入 $(inherited) 。
step2: 打开项目 Target - Build Settings,在FRAMEWORK_SEARCH_PATHS 这个块里添加一个元素为$(inherited) 。

问题13

问题描述:集成cocoapods的时候报错:'xxx' file not found with include; use "quotes" instead
解决步骤:

引用路径的问题,更改引用路径。例如:#import <JSONModel.h>,改成#import <JSONModel/JSONModel.h> 就可以了

问题14

问题描述:ld: framework not found TALMarsXlog_YHZZ
解决步骤:

原因是你项目导入的第三方framework或者私有库里的framework不支持模拟器导致导致,第一种xcode 连接真机编译;如果真的需要支持编译模拟器,如果自己有权限有修改依赖的framework进行重新编译模拟器架构的framework即可,如果没有操作权限只能换其他的库啦。

问题15

问题描述:[!] CocoaPods could not find compatible versions for pod "xxx":
In snapshot (Podfile.lock):

删除工程里 .xworkspace .podlock Pods文件 重新执行 pod install --repo-update 即可

问题16

问题描述: Cloning spec repo 'cocoapods' from 'https://github.com/CocoaPods/Specs.git'
一直等待中或者超时

方式1:http://ping.chinaz.com/github.com 进入这个网址 输入github.com 然后进行ping检测,获取ttl延迟最小的ip,在mac上 的host文件进行配置,ip + guithub.com 

方式2: 在cocoapods/repos/ 目录下 创建 master文件 ,进入master目录,
然后执行 git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git . ;
然后在进入自己项目中执行pod install 即可