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 的问题。

相关文章
相关标签/搜索