cocopods是負(fù)責(zé)管理iOS項(xiàng)目中第三方開(kāi)源庫(kù)的工具,可以節(jié)省我們?cè)O(shè)置和更新第三方開(kāi)源庫(kù)的時(shí)間,提高開(kāi)發(fā)效率恢总。
首先安裝的的操作太多了牡肉,我用的是http://www.reibang.com/p/0ba9edf8428d
前面一切順利彪笼,當(dāng)進(jìn)行到setup的時(shí)候會(huì)出現(xiàn)中斷的情況钻注,報(bào)的9806的錯(cuò)誤
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
下面是終端輸入的結(jié)果
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.
這個(gè)時(shí)候搜索一下pod search AFNetworking
[!] Unable to find a pod with name, author, summary, or description matching `AFNetworking`
這是因?yàn)橹皃od search的時(shí)候生成了緩存文件search_index.json,輸入下面的指令來(lái)刪除該文件
rm ~/Library/Caches/CocoaPods/search_index.json
然后再次輸入pod search AFNetworking進(jìn)行搜索
顯示如下結(jié)果的時(shí)候就說(shuō)明已經(jīng)安裝成功了
bogon:FangShiLiu mac$ rm ~/Library/Caches/CocoaPods/search_index.json
bogon:FangShiLiu mac$ pod search AFNetworking
Creating search index for spec repo 'master'.. Done!