CocoaPods 升級新版本問題

在公司把cocoapods升級到1.8.3版本以後,開始出現了問題,pod install和pod search都失效。git

執行pod install 以後,會一直卡在github

Analyzing dependencies

而後更新到cocoapods1.8.4, 問題依然存在。網絡

超時以後,會提示下面的錯誤code

[!] CDN: trunk Repo update failed

按照網上找到的教程,在podfile文件第一行添加 source,教程

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

再次執行pod install, 在下面的狀況卡住ci

Analyzing dependencies
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`

解決方案

CocoaPods 1.8將CDN切換爲默認的spec repo源是trunk源,podfile文件中必定要指定master源。
但咱們更改源以後還不能使用,可能與咱們的網絡有必定關係,下面是個人解決方案。rem

首先更改源,由於試過幾個經常使用的,都很差使,因此我改用了清華大學的源。get

下面摘自清華大學開源軟件鏡像站開源軟件

新版的 CocoaPods 不容許用pod repo add直接添加master庫了,可是依然能夠:

$ cd ~/.cocoapods/repos 
$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master

最後進入本身的工程,在本身工程的podFile第一行加上:

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

完事以後記得remove trunk ,執行下面的命令it

pod repo remove trunk

若是不執行remove還可能會出現 CDN:trunk 的問題。

相關文章
相關標籤/搜索