美文网首页
cocoaPod安装(避坑)

cocoaPod安装(避坑)

作者: iOS_林亦辰 | 来源:发表于2020-04-17 10:55 被阅读0次
    CocoaPods 是一个 Cocoa 和 Cocoa Touch 框架的依赖管理器,具体原理和 Homebrew 有点类似,都是从 GitHub 下载索引,然后根据索引下载依赖的源代码。

    很多人都用不多,安装好了能用就行了,但是安装过程,简直了,让人望而却步。
    下面开始介绍如何避坑,快速安装cocoapod:

    1.重点介绍:清华源

    对于旧版的 CocoaPods 可以使用如下方法使用 tuna 的镜像:

    $ pod repo remove master
    $ pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
    $ pod repo update
    

    新版的 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'
    

    多人实测速度5M/s+
    附图


    image.png
    image.png

    安装完成示意图


    image.png

    当然还有华为的镜像,CSDN的镜像等,感觉还是清华🐂🍺,速度杠杠滴

    注意:
    一定要先cd到~/.cocoapods/repos目录,再执行git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master命令,否则指定失败。error: RPC failed; curl 56 SSLRead() return error -36
    如果在安装完成之后,没有切换源,那么在自己的pod文件中,一定要加上source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'这句话

    image.png

    pod install或者pod update之前,先pod repo remove trunk索引库,

    常用命令如下

    //初始化
    pod install
    //查看pod源
    pod repo
    //移除索引库
    pod repo remove trunk
    

    如果还是不知道该怎么配置,安装,请加我们的QQ群:622177838,我给你发送所有需要的文件,前提请注意加好友时候留言清楚。

    参考链接:
    清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/CocoaPods/

    相关文章

      网友评论

          本文标题:cocoaPod安装(避坑)

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