coverImage
libwebp是SDWebImage依賴的庫,當(dāng)SDWebImage更新時(shí)官研,libwebp也會(huì)更新卓箫。
每次當(dāng)執(zhí)行 pod install
或pod update
時(shí),到Installing libwebp
這一步時(shí)贴唇,都會(huì)超時(shí)錯(cuò)誤,如下:
Installing libwebp 0.6.1 (was 0.5.1)
[!] Error installing libwebp
[!] /usr/bin/git clone https://chromium.googlesource.com/webm/libwebp /var/folders/q6/fb3nsmhx2wb85y8lsdz_d_nr0000gn/T/d20180525-18599-1lhp0ft --template= --single-branch --depth 1 --branch v0.6.1
Cloning into '/var/folders/q6/fb3nsmhx2wb85y8lsdz_d_nr0000gn/T/d20180525-18599-1lhp0ft'...
fatal: unable to access 'https://chromium.googlesource.com/webm/libwebp/': Failed to connect to chromium.googlesource.com port 443: Operation timed out
嘗試過翻墻飞袋,修改host文件戳气,均無效。
最終找到一個(gè)有效的方法是巧鸭,修改 libwebp 的 git source 地址瓶您。
默認(rèn)地址是:https://chromium.googlesource.com/webm/libwebp
修改為:https://github.com/webmproject/libwebp.git
操作步驟:
- 查看 mac 中 cocoapods 本地庫路徑:
? ~ pod repo
master
- Type: git (master)
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/apple/.cocoapods/repos/master
- 在本地庫中, 并找到對(duì)應(yīng)的 libwebp 版本的文件
? ~ find /Users/apple/.cocoapods/repos/master -iname libwebp
/Users/apple/.cocoapods/repos/master/Specs/1/9/2/libwebp
- 進(jìn)入libwebp目錄,可以看到你的倉庫中有哪些對(duì)應(yīng)的版本
? ~ cd /Users/apple/.cocoapods/repos/master/Specs/1/9/2/libwebp
? libwebp git:(master) ls -l
total 0
drwxr-xr-x 3 iTruda staff 96 4 10 2017 0.4.1
drwxr-xr-x 3 iTruda staff 96 4 10 2017 0.4.2
drwxr-xr-x 3 iTruda staff 96 4 10 2017 0.4.3
drwxr-xr-x 3 iTruda staff 96 4 10 2017 0.4.4
drwxr-xr-x 3 iTruda staff 96 4 10 2017 0.5.0
drwxr-xr-x 3 iTruda staff 96 4 10 2017 0.5.1
drwxr-xr-x 3 iTruda staff 96 6 14 2017 0.5.2
drwxr-xr-x 3 iTruda staff 96 6 14 2017 0.6.0
drwxr-xr-x 3 iTruda staff 96 5 25 11:49 0.6.1
- 由于 SDWebImage 當(dāng)前版本依賴的 libwebp 版本為0.6.1纲仍,所以我們進(jìn)入0.6.1中呀袱,并做修改
? libwebp git:(master) cd 0.6.1
? 0.6.1 git:(master) ls -l
total 8
-rw-r--r-- 1 iTruda staff 1694 5 25 11:49 libwebp.podspec.json
- 在0.6.1目錄下的 libwebp.podspec.json 文件中修改 git source
? 0.6.1 git:(master) sudo vim libwebp.podspec.json
Password:
- 找到
source
字段,將其中的"git" 對(duì)應(yīng)的 url 替換為https://github.com/webmproject/libwebp.git
郑叠,并保存
"source": {
"git": "https://github.com/webmproject/libwebp.git",
"tag": "v0.6.1"
},
- 再次執(zhí)行
pod install
(注意:不要執(zhí)行pod update
夜赵,因?yàn)閘ibwebp.podspec.json 文件會(huì)被重新創(chuàng)建,前面的修改就無效了)