1.cocoapods 1.8+ pod install 卡住 慢
參考以下鏈接更換spec repo源
https://www.colabug.com/2019/1225/6769937/amp/
在公司把cocoapods升級(jí)到1.8.3版本之后,開始出現(xiàn)了問(wèn)題,pod install和pod search都失效。
執(zhí)行pod install 之后,會(huì)一直卡在
Analyzing dependencies
然后更新到cocoapods1.8.4, 問(wèn)題依然存在。
超時(shí)之后,會(huì)提示下面的錯(cuò)誤
[!] CDN: trunk Repo update failed
按照網(wǎng)上找到的教程,在podfile文件第一行添加 source,
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
再次執(zhí)行pod install, 在下面的情況卡住
Analyzing dependencies
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
解決方案
CocoaPods 1.8將CDN切換為默認(rèn)的spec repo源是trunk源,podfile文件中一定要指定master源。
但我們更改源之后還不能使用,可能與我們的網(wǎng)絡(luò)有一定關(guān)系,下面是我的解決方案。
首先更改源,因?yàn)樵囘^(guò)幾個(gè)常用的,都不好使,所以我改用了清華大學(xué)的源。
下面摘自清華大學(xué)開源軟件鏡像站
新版的 CocoaPods 不允許用pod repo add直接添加master庫(kù)了,但是依然可以:
$ cd ~/.cocoapods/repos
$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
最后進(jìn)入自己的工程,在自己工程的podFile第一行加上:
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
完事之后記得remove trunk ,執(zhí)行下面的命令
pod repo remove trunk
如果不執(zhí)行remove還可能會(huì)出現(xiàn) CDN:trunk 的問(wèn)題。