美文网首页
2018-06-26 IOS学习知识点2

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

作者: 北你妹的风 | 来源:发表于2018-06-26 16:36 被阅读3次

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

    相关文章

      网友评论

          本文标题:2018-06-26 IOS学习知识点2

          本文链接:https://www.haomeiwen.com/subject/mijmyftx.html