使用cocoapods時(shí),經(jīng)常會(huì)遇到卡死的情況。通常有以下解決方式:
1、更新ruby源
gem sources -l ?//當(dāng)前ruby 源
gem sources --remove ?https://xxxx.ruby.org/ ? //刪除當(dāng)前ruby源
gem ?sources -a https://gems.ruby-china.org
2、更新 pod repo 源
pod repo ? //查看當(dāng)前的pod repo ?源
cocoapods默認(rèn)的源時(shí)github的,速度比較慢,執(zhí)行pod install 或pod update時(shí)要等半天。
修改pod repo 為國(guó)內(nèi)的源,這里介紹幾個(gè)國(guó)內(nèi)的鏡像源
https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git?//清華大學(xué)鏡像源
https://mirrors.shu.edu.cn/CocoaPods?//(僅HTTP/HTTPS訪問,不支持git拉?。?上海大學(xué)
https://mirrors.shu.edu.cn/mgit/Specs? //(僅git訪問)?
https://git.shuosc.org/CocoaPods/Specs?//?(均支持)
先刪除原有的鏡像源:
pod repo ?remove master
pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
pod repo update
新版cocoapods不支持add ?直接添加master了,可以使用clone命令:
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git ? ???~/.cocoapods/repos/master
再次使用以下命令查看鏡像源
pod repo ? //查看當(dāng)前的pod repo ?源
另外,要記得在自己工程中的podfile文件中加入以下內(nèi)容
source ‘https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git’
然后,你就可以開心的安裝或更新了:
pod ?install ??--verbose --no-repo-update?