拆分framework
先把framework拷贝到两个文件夹下边,这里只需要armv7、arm64、x86_64。
bash
mkdir iphoneos iphonesimulator
cp -R mysdk.framework iphoneos
cp -R mysdk.framework iphonesimulator
把iphoneos中的模拟器指令集删除,只保留armv7和arm64
bash
lipo -remove i386 -remove x86_64 iphoneos/mysdk.framework/mysdk -o iphoneos/mysdk.framework/mysdk
#查看指令集
lipo -info iphoneos/mysdk.framework/mysdk
把iphonesimulator中的除模拟器之外的指令集删除,只保留x86_64
bash
lipo -remove i386 -remove armv7 -remove arm64 iphonesimulator/mysdk.framework/mysdk -o iphonesimulator/mysdk.framework/mysdk
#查看指令集
lipo -info iphonesimulator/mysdk.framework/mysdk
合成xcframework
使用xcodebuild 进行合成
bash
xcodebuild -create-xcframework -framework iphoneos/mysdk.framework -framework iphonesimulator/mysdk.framework -output "mysdk.xcframework"