2018-06-26 IOS学习知识点2

使用cocoapods时,经常会遇到卡死的情况。通常有以下解决方式:

1、更新ruby源

gem sources -l  //当前ruby 源

gem sources --remove  https://xxxx.ruby.org/   //删除当前ruby源

gem  sources -a https://gems.ruby-china.org


2、更新 pod repo 源

pod repo   //查看当前的pod repo  源

cocoapods默认的源时github的,速度比较慢,执行pod install 或pod update时要等半天。

修改pod repo 为国内的源,这里介绍几个国内的镜像源

https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git //清华大学镜像源

https://mirrors.shu.edu.cn/CocoaPods //(仅HTTP/HTTPS访问,不支持git拉取) 上海大学

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   //查看当前的pod repo  源

另外,要记得在自己工程中的podfile文件中加入以下内容

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

然后,你就可以开心的安装或更新了:

pod  install   --verbose --no-repo-update 

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容