1、 首先,cd到当前framework文件夹目录下
lipo -info XXXX.framework/XXXX
例:
➜ lib git:(master) ✗ lipo -info JMessage.framework/JMessage
Architectures in the fat file: JMessage.framework/JMessage are: armv7 armv7s x86_64 arm64
armv7|armv7s|arm64都是ARM处理器的指令集
i386|x86_64 是Mac处理器的指令集(即模拟器)
从framework中分离出某一种架构,比如 armv7 armv7s arm64 :
lipo XXX.framework/XXX -thin armv7s -output XXX.framework/XXX-armv7s
例:
➜ lib git:(master) ✗ lipo JMessage.framework/JMessage -thin armv7 -output JMessage.framework/JMessage-armv7
➜ lib git:(master) ✗ lipo JMessage.framework/JMessage -thin armv7s -output JMessage.framework/JMessage-armv7s
➜ lib git:(master) ✗ lipo JMessage.framework/JMessage -thin arm64 -output JMessage.framework/JMessage-arm64
合并分离出的三种架构:
lipo -create XXXX.framework/XXXX-arm64 XXXX.framework/XXXX-armv7 XXXX.framework/XXXX-armv7s -output XXXX.framework/XXXX-arm
例:
➜ lib git:(master) ✗ lipo -create JMessage.framework/JMessage-arm64 JMessage.framework/JMessage-armv7 JMessage.framework/JMessage-armv7s -output JMessage.framework/JMessage-arm
原来的库100MB,瘦身后还有90M
移除相关架构
比如移除 移除x86_64, i386
lipo -remove i386 XXX.framework/XXX -o XXX.framework/XXX
lipo -remove x86_64 XXX.framework/XXX -o XXX.framework/XXX