2018-06-26 IOS學(xué)習(xí)知識(shí)點(diǎn)2

使用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?

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容