參考博文:http://blog.csdn.net/zhangxiweicaochen/article/details/77651049
首先下載 libwebp
http://www.linuxfromscratch.org/blfs/view/svn/general/libwebp.html
下載完成后解壓並運行 iosbuild.sh 文件,會生成iosbuild文件夾
工程中有一個iosbuild.sh腳本,然后直接執行。但是發現執行完的framewrok中並沒有

/* * This file is part of the SDWebImage package. * (c) Olivier Poitrey <rs@dailymotion.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ #ifdef SD_WEBP #import "UIImage+WebP.h" #import "webp/decode.h" #import "webp/mux_types.h" #import "webp/demux.h" #import "NSImage+WebCache.h" #import "objc/runtime.h" // Callback for CGDataProviderRelease static void FreeImageData(void *info, const void *data, size_t size) { free((void *)data); }
顯而易見,報錯了,引入的文件沒有,但是看一下工程結構。

工程中都有該文件,顯然在執行iosbuild.sh沒有打包進去,那我們做的就非常簡單了。
最后一步修改 iosbuild.sh腳本,125行加入別的幾個類文件,執行./iosbuild.sh 生成的framework就可以用了。
cp -a ${SRCDIR}/src/webp/{config,demux,format_constants,mux_types,mux,decode,encode,types}.h ${TARGETDIR}/Headers/ ${LIPO} -create ${LIBLIST} -output ${TARGETDIR}/WebP
但是加入重新編譯的WebP.framework后,出現如下錯誤:

