可能会遇到libwebp v1.0.3超时问题:
解决方法:
尝试过翻墙,修改host
,均无效
最终,修改pod repo
中libwebp
的git source
地址,再执行pod install
解决,
但是我们需要有一个有效的libwebp
的git
仓库,在github
上找到了一个https://github.com/webmproject/libwebp.git
,可以看到 mirrored from https://chromium.googlesource.com/webm/libwebp
,而且正好有我需要的版本1.0.3
, 那么我就替换为这个。
下面是步骤:
1.查看mac
中cocoapods
本地库路径:
swaedeMacBook-Pro:alpface swae$ pod repo
2.在本地库中, 并找到对应的libwebp版本的文件
swaedeMacBook-Pro:alpface swae$ find ~/.cocoapods/repos/master -iname libwebp
/Users/swae/.cocoapods/repos/master/Specs/1/9/2/libwebp
进入libwebp
目录,可以看到你的仓库中有哪些对应的版本
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 cct staff 96 Aug 13 2018 0.4.1
drwxr-xr-x 3 cct staff 96 Aug 13 2018 0.4.2
drwxr-xr-x 3 cct staff 96 Aug 13 2018 0.4.3
drwxr-xr-x 3 cct staff 96 Aug 13 2018 0.4.4
drwxr-xr-x 3 cct staff 96 Aug 13 2018 0.5.0
drwxr-xr-x 3 cct staff 96 Aug 13 2018 0.5.1
drwxr-xr-x 3 cct staff 96 Aug 13 2018 0.5.2
drwxr-xr-x 4 cct staff 128 Sep 12 2019 0.6.0
drwxr-xr-x 3 cct staff 96 Jun 4 2019 0.6.1
drwxr-xr-x 3 cct staff 96 Aug 13 2018 1.0.0
drwxr-xr-x 3 cct staff 96 Mar 8 2019 1.0.1
drwxr-xr-x 3 cct staff 96 Mar 14 17:00 1.0.2
drwxr-xr-x 4 cct staff 128 Mar 14 17:00 1.0.3
drwxr-xr-x 3 cct staff 96 Mar 14 17:00 1.1.0
drwxr-xr-x 3 cct staff 96 Jan 4 10:59 1.1.0-rc2
由于SDWebImage
依赖的 libwebp
版本为1.0.3
,所以我们进入1.0.3
中,并做修改
swaedeMacBook-Pro:libwebp swae$ cd 1.0.3/
swaedeMacBook-Pro:0.6.0 swae$ ls -l
total 8
-rw-r--r--@ 1 swae staff 1587 4 15 09:53 libwebp.podspec.json
在1.0.3
目录下的libwebp.podspec.json
文件中修改git source
(点击i进入INSERT
编辑模式)
swaedeMacBook-Pro:1.0.3 swae$ sudo vim libwebp.podspec.json
{
"name": "libwebp",
"version": "1.0.3",
"summary": "Library to encode and decode images in WebP format.",
"homepage": "https://developers.google.com/speed/webp/",
"authors": "Google Inc.",
"license": {
"type": "BSD",
"file": "COPYING"
},
"source": {
"git": "https://chromium.googlesource.com/webm/libwebp",
"tag": "v1.0.3"
},
"compiler_flags": "-D_THREAD_SAFE",
"requires_arc": false,
"platforms": {
"osx": "10.8",
"ios": "6.0",
"tvos": "9.0",
"watchos": "2.0"
},
-- INSERT --
找到下面代码
"source": {
"git": "https://chromium.googlesource.com/webm/libwebp",
"tag": "v1.0.3"
},
将其中的"git"
对应的url
替换为https://github.com/webmproject/libwebp.git
,并保存 (点击ESC
退出编辑模式,然后输入 :wq
) ,过程有点漫长,请耐心等待
最后再进入对应的项目中,重新执行pod install
, 成功
swaedeMacBook-Pro:alpface swae$ pod install