项目里文件liblibWeex.a库引用了SDWebImage的文件,但是项目其他库也有使用到该库,冲突了!
解决方案
1、拆分liblibWeex.a 为四个liblibWeex_arm64.a liblibWeex_i386.a liblibWeex_armv7.a liblibWeex_x86_64.a强烈建议四个操作分开文件进行,这里拆分成 四个 .a文件的前提是原来的.a本身就支持上面四个架构版本:
查看.a支持架构
lipo -info 路径
例如:
lipo -info /Users/qing/Desktop/HelloSDK.framework/HelloSDK
lipo liblibWeex.a -thin arm64 -output liblibWeex_arm64.a
lipo liblibWeex.a -thin armv7 -output liblibWeex_armv7.a
lipo liblibWeex.a -thin i386 -output liblibWeex_i386.a
lipo liblibWeex.a -thin x86_64 -output liblibWeex_x86_64.a
建议创建4个文件夹,这里分别命名为:arm64、armv7、i386、x86。
2、cd到对应文件夹内,把拆分的.a文件再拆分成.o文件(分开文件夹进行)
ar -x liblibWeex_arm64.a
ar -x liblibWeex_armv7.a
ar -x liblibWeex_i386.a
ar -x liblibWeex_x86_64.a
拆分完成之后可以看到文件夹内多了很多.o的文件了

image.png
3、删掉冲突文件,这里删掉的文件较多,对比着SDWebImage进行删除!为了避免删错了,建议对照着SDWebImage库进行删除。
这里删掉的文件为:
UIImage+GIF.o
UIButton+WebCache.o
UIImage+MultiFormat.o
UIImageView+HighlightedWebCache.o
UIImageView+WebCache.o
UIView+WebCacheOperation.o
SDImageCache.o
SDWebImageCompat.o
SDWebImageDecoder.o
SDWebImageDownloader.o
SDWebImageDownloaderOperation.o
SDWebImageManager.o
SDWebImagePrefetcher.o
NSData+ImageContentType.o
4、将删掉冲突文件的.o文件合并:
libtool -static -o ../liblibWeex_arm64.a *.o
libtool -static -o ../liblibWeex_armv7.a *.o
libtool -static -o ../liblibWeex_i386.a *.o
libtool -static -o ../liblibWeex_x86_64.a *.o

image.png
5、将生成的.a文件合并成最初的.a文件
lipo -create -output liblibWeex.a liblibWeex_arm64.a liblibWeex_i386.a liblibWeex_armv7.a liblibWeex_x86_64.a