1.三言两语阐述下现状
前因后果暂且不提 ,目前我安装的cocoapods版本是1.9.1,而且是直接安装的新版本,所以
.cocoapods/repos/
下只有一个trunk,没有master等其他文件夹。
cocoapods1.8会后CDN被作为spec的默认仓库来源,好处的话第一次安装的时间大幅缩短,不用从https://github.com/CocoaPods/Specs.git
上拉取整个仓库代码,后面用到的时候也只会拉取当前所需。
说起来也是没办法,降级回去安装的时候pod setup
下载又卡住,安装不成,只能重新换回1.9继续搞。
2.主要问题及解决办法
2.1 RPC failed
2.1.1 问题描述
RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
2.1.2解决办法
git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
或者使用别的源
https://gitclub.cn/CocoaPods/Specs.git
https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
2.2 trunk连接问题
2.2.1问题描述
[!] CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/ Response: 400
或
[!] CDN: trunk Repo update failed - 70 error(s): CDN: trunk URL couldn't be downloaded: [库信息], error: Failed to open TCP connection to raw.githubusercontent.com:443
或
[!] CDN: trunk Repo update failed - 14 error(s): CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/[库路径].podspec.json Response: Couldn't connect to server
2.2.2解决办法
解决思路有两条,一条是退回旧方式,另一条是使用新方式,其中退回旧方式又分为两种。
2.2.2.1 退回旧方式1 - 回退cocoapods版本
1.查看gem本地安装的cocoapods版本
gem list
2.删除cocoapods和cocoapods-core程序包
sudo gem uninstall cocoapods -v版本号
sudo gem uninstall cocoapods-core -v版本号
3.安装其他版本cocoapods
sudo gem install cocoapods -v版本号
2.2.2.2 退回旧方式2 - 指定source源
1.podfile文件中制定source源为master。
source 'https://github.com/CocoaPods/Specs.git'
2.移除trunk源。
执行pod repo remove trunk
2.2.2.3 使用新特性,解决DNS污染问题
1.编辑Podfile,将CDN设置为主要来源,
1.8+
是默认项
source 'https://cdn.cocoapods.org/'
2.有master的可以移除master了
pod repo remove master
https://site.ip138.com/raw.githubusercontent.com/3.获得raw.githubusercontent.com的真实ip地址
可以使用nslookup raw.githubusercontent.com
获取
也可以使用https://www.ipaddress.com或https://site.ip138.com/raw.githubusercontent.com/输入raw.githubusercontent.com
查询ip地址。
4.修改hosts
终端输入sudo vi /etc/hosts
输入i
进入编辑模式
在最后一行添加151.101.76.133 raw.githubusercontent.com
其中151.101.76.133
是上一步中获取的ip地址
control+c
退出编辑
输入:wq!
保存退出
5.重试下就可以了
不行的话可以刷新下DNS缓存sudo killall -HUP mDNSResponder
网友评论