*************************************** 20200601更新 start ***************************************
描述:执行pod操作,报错
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/a/7/6/Analytics/4.0.0-beta.1/Analytics.podspec.json Response: SSL peer certificate or SSH remote key was not OK
解决办法:在 podfile文件中添加source源
source 'https://github.com/CocoaPods/Specs.git'
*************************************** 20200601更新 end ***************************************
************************************* 我是一条朴素的分割线 *************************************
*************************************** 20200526更新 start ***************************************
描述:执行
pod search "AudioKit"
,报错
[!] CDN: trunk Repo update failed - 61 error(s):
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/1/6/8/AudioKit/1.2/AudioKit.podspec.json Response: Couldn't connect to server
执行 pod install
,报错
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "AudioKit":
In Podfile:
AudioKit (~> 4.9.5)
None of your spec sources contain a spec satisfying the dependency: `AudioKit (~> 4.9.5)`.
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
解决办法:更新本地pod仓库
pod install --repo-update
*************************************** 20200526更新 end ***************************************
************************************* 我是一条朴素的分割线 *************************************
错误描述
[!] Error installing ReactiveCocoa
[!] /usr/bin/git clone https://github.com/ReactiveCocoa/ReactiveCocoa.git /var/folders/np/3ty5h5jd439ft50q9s0ygnfh0000gn/T/d20200421-5534-yfmqbf --template= --single-branch --depth 1 --branch 7.2.0
Cloning into '/var/folders/np/3ty5h5jd439ft50q9s0ygnfh0000gn/T/d20200421-5534-yfmqbf'...
fatal: unable to access 'https://github.com/ReactiveCocoa/ReactiveCocoa.git/': Failed to connect to github.com port 443: Operation timed out
看到这里, 我上来就 ping github.com
了一下 发现直接就 timeout
了,淡淡的忧伤。
使用DNS
工具查找github.com
等域名TTL
较小的 IP
1. 打开链接 http://ping.chinaz.com 输入 github.com
,点击Ping检测
2. 选择一条TTL值最小的ip地址,例如:192.30.255.113
修改hosts
sudo vim /private/etc/hosts
- 追加一行:
192.30.253.113 github.com
FAQ
什么是hosts?
Hosts是一个没有扩展名的系统文件,可以用记事本等工具打开,其作用就是将一些常用的网址域名与其对应的IP地址建立一个关联“数据库”,当用户在浏览器中输入一个需要登录的网址时,系统会首先自动从Hosts文件中寻找对应的IP地址,一旦找到,系统会立即打开对应网页,如果没有找到,则系统会再将网址提交DNS域名解析服务器进行IP地址的解析。
每次改完配置需要重启机器吗?
不需要,它实质上是个文本文件,当计算机需要解析地址时,会首先检查此文件,读取后再确定是本地解析还是要发送到DNS服务器来解析。
改后,只要再上网,就会生效。
hosts文件在哪里?
Linux:/etc/hosts
Mac OS X:/etc/hosts
Android:/etc/hosts
Windows:C:/windows/System32/drivers/etc/hosts
hosts文件规则?
#ip地址 域名
127.0.0.1 localhost
192.30.255.113 github.com
::1 localhost
至此, ping github.com
和pod install
都正常了,爽歪歪!
参考: