关于ios开发framework及.a文件支持架构判断以及合并

来源:互联网 发布:淘宝冻结资金在哪里看 编辑:程序博客网 时间:2024/05/19 15:40

 在ios开发中,每个工程都会用到别人封装的一些好的框架,但是这些框架不一定全部支持真机和模拟器测试,所以我们需要提前判断一下它们是否支持真机或者模拟器,而且我们在制作自己的封装库时,如果我们想我们的框架能够既支持真机又支持模拟器,那就需要对生成的库进行合并!

    判断framework或.a文件支持框架:

lipo -info /Users/.../xFramework.framework/xFramework

lipo -info  /Users/.../libXYPlatform.a

    结果

Architectures in the fat file: xsdkFramework are: armv7 arm64 不支持模拟器

Architectures in the fat file: libUPPayPlugin.a are: armv7  arm64 i386 x86_64 支持真机和模拟器

     framework的合并

1.lipo -create /Users/.../RKPlatform.framework/RKPlatform /Users/.../RKPlatform.framework/RKPlatform -output /Users/.../Desktop/RKPlatform

前两个是分别支持真机和模拟器的framework的路径 -output后是合并后输出可执行文件的路径

2.然后把生成后的可执行文件RKPlatform替换合并前任意一个framework里面的可执行文件RKPlatform就OK了


常见错误如下:

iOS Framework lipo报错 lipo: can't map input file

fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't map input file: xxxFramework.framework/ (Invalid argument)

原因在于:

lipo -info xxxFramework.framework
而命令需要是

lipo -info xxxFramework.framework/xxxFramework
或者

cd xxxFramework.frameworklipo -info xxxFramework
参考:http://www.jianshu.com/p/99a5ac602123
阅读全文
0 0