美文网首页
iOS使用cocoapods 安装 libwebp0.6.0 遇

iOS使用cocoapods 安装 libwebp0.6.0 遇

作者: CoderLGL | 来源:发表于2018-11-05 15:45 被阅读0次

    原文地址

    可能会遇到libwebp v0.6.0 超时问题:

    [!] Error installing libwebp
    [!] /usr/bin/git clone https://chromium.googlesource.com/webm/libwebp /var/folders/p6/t42f8nmd7332018zm9m2s3d80000gn/T/d20180415-42656-1hjxh43 --template= --single-branch --depth 1 --branch v0.6.0
    
    Cloning into '/var/folders/p6/t42f8nmd7332018zm9m2s3d80000gn/T/d20180415-42656-1hjxh43'...
    fatal: unable to access 'https://chromium.googlesource.com/webm/libwebp/': Failed to connect to chromium.googlesource.com port 443: Operation timed out
    

    解决方法:
    尝试过翻墙,修改host,均无效
    最终,修改pod repolibwebpgit source 地址,再执行pod install解决,
    但是我们需要有一个有效的libwebpgit仓库,在github上找到了一个https://github.com/webmproject/libwebp.git,可以看到mirrored from https://chromium.googlesource.com/webm/libwebp,而且正好有我需要的版本0.6.0, 那么我就替换为这个。
    下面是步骤:

    1. 查看mac中cocoapods 本地库路径:
    //以下在终端中打开
     pod repo
    
    /Users/swae/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/cocoapods-1.4.0/lib/cocoapods/executable.rb:89: warning: Insecure world writable dir /opt in PATH, mode 040777
    
    master
    - Type: git (master)
    - URL:  https://github.com/CocoaPods/Specs.git
    - Path: /Users/swae/.cocoapods/repos/master
    
    1. 在本地库中, 并找到对应的libwebp版本的文件
    //以下在终端中打开
    find ~/.cocoapods/repos/master -iname libwebp
    
    
    /Users/liguangliang/.cocoapods/repos/master/Specs/1/9/2/libwebp
    

    进入libwebp目录,可以看到你的仓库中有哪些对应的版本

    liguangliangdeMac-mini:~ liguangliang$ cd /Users/liguangliang/.cocoapods/repos/master/Specs/1/9/2/libwebp
    liguangliangdeMac-mini:libwebp liguangliang$ ls -l
    
    total 0
    drwxr-xr-x  3 liguangliang  staff  102 10 16 12:02 0.4.1
    drwxr-xr-x  3 liguangliang  staff  102 10 16 12:02 0.4.2
    drwxr-xr-x  3 liguangliang  staff  102 10 16 12:02 0.4.3
    drwxr-xr-x  3 liguangliang  staff  102 10 16 12:02 0.4.4
    drwxr-xr-x  3 liguangliang  staff  102 10 16 12:02 0.5.0
    drwxr-xr-x  3 liguangliang  staff  102 10 16 12:02 0.5.1
    drwxr-xr-x  3 liguangliang  staff  102 10 16 12:02 0.5.2
    drwxr-xr-x  3 liguangliang  staff  102 10 16 12:02 0.6.0
    drwxr-xr-x  3 liguangliang  staff  102 11  5 15:31 0.6.1
    drwxr-xr-x  4 liguangliang  staff  136 11  5 15:31 1.0.0
    

    由于SDWebImage 依赖的 libwebp版本为0.6.0,所以我们进入0.6.0中,并做修改

    
    cd 0.6.0/
    
    ls -l
    
    total 8
    -rw-r--r--@ 1 swae  staff  1587  4 15 09:53 libwebp.podspec.json
    

    在0.6.0目录下的libwebp.podspec.json文件中修改git source

    sudo vim libwebp.podspec.json
    

    找到

    "source": {
    "git": "https://chromium.googlesource.com/webm/libwebp",
    "tag": "v0.6.0"
    },
    

    将其中的"git" 对应的url替换为https://github.com/webmproject/libwebp.git,并保存
    最后再执行pod install

    完成

    相关文章

      网友评论

          本文标题:iOS使用cocoapods 安装 libwebp0.6.0 遇

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