Xcode12模拟器打包静态库支持arm64架构引发的系列问题总结

问题:真机模拟器库无法合并,报错:have the same architectures (arm64) and can't be in the same fat output file

分析:Xcode12之前:编译模拟器静态库支持i386  x86_64两架构;编译真机静态库支持armv7 arm64两架构。在使用lipo -create -output命令可以将两个库合并成一个支持模拟器和真机i386 x86_64 armv7 arm64四种架构的胖子库。但是现在Xcode12编译的模拟器静态库也支持了arm64,导致出现真机库和模拟器库不能合并的问题。【have the same architectures (arm64) and can't be in the same fat output file】

解决办法:

1.如果有静态库工程:在工程里面进行如下设置

Build Settings -> Excluded Architectures里按照这样设置一下,再编译合并就不会报错了。

 
2.如果手里只有.a或.framework文件,使用lipo remove命令将模拟器库的arm64架构移除
lipo XXX.a -remove arm64 -output XXX.a

 

posted @ 2021-02-25 17:03  yoowei  阅读(2455)  评论(0编辑  收藏  举报