CocoaPods 在1.8以后默認使用CDN的方式后執行pod install 會出現報錯:
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/***.json Response: Couldn't connect to server
在網上看了很多的資料,都是要求移除trunk然后恢復之前的方式去使用,我個人并不傾向于這種方式,于是查找了別的資料,最終找到解決方案,記錄并給其他遇到該問題的朋友一些引導,說明如下:
1、檢查你的當前source鏡像:
gem source -l
移除舊的鏡像:
gem source -r +你原先的鏡像地址
修改新鏡像為:
gem source -a?https://gems.ruby-china.com
2、查找?githubusercontent.com?的IP
鏈接地址:https://githubusercontent.com.ipaddress.com/raw.githubusercontent.com
IP 地址查詢
3、修改host文件
前往/etc/hosts,編輯文件,在最后面添加上IP映射:
199.232.68.133 raw.githubusercontent.com
保存后打開命令終端執行代碼刷新DMS:
sudo dscacheutil -flushcache
4、重新cd 到自己的工程路徑,執行安裝即可
pod install