可能會遇到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 repo中l(wèi)ibwebp的git source 地址,再執(zhí)行pod install 解決混巧,
但是我們需要有一個有效的libwebp的git倉庫萤捆,在github上找到了一個https://github.com/webmproject/libwebp.git
裙品,可以看到mirrored from https://chromium.googlesource.com/webm/libwebp
,而且正好有我需要的版本0.6.0, 那么我就替換為這個俗或。
下面是步驟:
- 查看mac中cocoapods 本地庫路徑:
swaedeMacBook-Pro:alpface swae$ 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
- 在本地庫中, 并找到對應(yīng)的libwebp版本的文件
swaedeMacBook-Pro:alpface swae$ find ~/.cocoapods/repos/master -iname libwebp
/Users/swae/.cocoapods/repos/master/Specs/1/9/2/libwebp
進入libwebp目錄市怎,可以看到你的倉庫中有哪些對應(yīng)的版本
swaedeMacBook-Pro:libwebp swae$ cd ~/.cocoapods/repos/master/Specs/1/9/2/libwebp
swaedeMacBook-Pro:libwebp swae$ ls -l
total 0
drwxr-xr-x 3 swae staff 96 12 3 21:50 0.4.1
drwxr-xr-x 3 swae staff 96 12 3 21:50 0.4.2
drwxr-xr-x 3 swae staff 96 12 3 21:50 0.4.3
drwxr-xr-x 3 swae staff 96 12 3 21:50 0.4.4
drwxr-xr-x 3 swae staff 96 12 3 21:50 0.5.0
drwxr-xr-x 3 swae staff 96 12 3 21:50 0.5.1
drwxr-xr-x 3 swae staff 96 12 3 21:50 0.5.2
drwxr-xr-x 3 swae staff 96 12 3 21:50 0.6.0
由于SDWebImage 依賴的 libwebp版本為0.6.0,所以我們進入0.6.0中辛慰,并做修改
swaedeMacBook-Pro:libwebp swae$ cd 0.6.0/
swaedeMacBook-Pro:0.6.0 swae$ 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
swaedeMacBook-Pro:0.6.0 swae$ sudo vim libwebp.podspec.json
找到
"source": {
"git": "https://chromium.googlesource.com/webm/libwebp",
"tag": "v0.6.0"
},
將其中的"git"
對應(yīng)的url替換為https://github.com/webmproject/libwebp.git
,并保存
最后再執(zhí)行pod install
, 完成
swaedeMacBook-Pro:alpface swae$ pod install
/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
Analyzing dependencies
Downloading dependencies
Installing SDWebImage (4.3.3)
Installing libwebp (0.6.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 8 dependencies from the Podfile and 9 total pods installed.