CocoPods的安装及遇到的问题解决

cocopods是负责管理iOS项目中第三方开源库的工具,可以节省我们设置和更新第三方开源库的时间,提高开发效率。

首先安装的的操作太多了,我用的是http://www.jianshu.com/p/0ba9edf8428d
前面一切顺利,当进行到setup的时候会出现中断的情况,报的9806的错误

bogon:~ mac$ pod setup
Setting up CocoaPods master repo
  $ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress
  Cloning into 'master'...
  remote: Counting objects: 1681647, done.        
  remote: Compressing objects: 100% (561/561), done.        
  error: RPC failed; curl 56 SSLRead() return error -9806 506.00 KiB/s   
  fatal: The remote end hung up unexpectedly
  fatal: early EOF
  fatal: index-pack failed
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress

Cloning into 'master'...
remote: Counting objects: 1681647, done.        
remote: Compressing objects: 100% (561/561), done.        
error: RPC failed; curl 56 SSLRead() return error -9806 506.00 KiB/s   
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

解决方法:

sudo gem install -n /usr/local/bin cocoapods
Git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master 

下面是终端输入的结果

bogon:~ mac$ sudo gem install -n /usr/local/bin cocoapods
Password:
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Successfully installed cocoapods-1.3.1
Parsing documentation for cocoapods-1.3.1
1 gem installed
bogon:~ mac$ Git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master 
Cloning into '/Users/mac/.cocoapods/repos/master'...
remote: Counting objects: 1130099, done.
remote: Total 1130099 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1130099/1130099), 408.72 MiB | 486.00 KiB/s, done.
Resolving deltas: 100% (563214/563214), done.
Checking out files: 100% (141834/141834), done.

这个时候搜索一下pod search AFNetworking

[!] Unable to find a pod with name, author, summary, or description matching `AFNetworking`

这是因为之前pod search的时候生成了缓存文件search_index.json,输入下面的指令来删除该文件

rm ~/Library/Caches/CocoaPods/search_index.json

然后再次输入pod search AFNetworking进行搜索
显示如下结果的时候就说明已经安装成功了

bogon:FangShiLiu mac$ rm ~/Library/Caches/CocoaPods/search_index.json
bogon:FangShiLiu mac$ pod search AFNetworking
Creating search index for spec repo 'master'.. Done!

你可能感兴趣的:(CocoPods的安装及遇到的问题解决)