Xcode工程中缺少i386或者x86_64第三方库无法link工程时,可以这么做
- 建立一个静态库工程(framework或static library),类型需要和第三方库一致,比如第三方库是xxx.framework形式则需要创建framework类型,如果第三方库是xxx.a形式则需要创建static library类型
- 在新工程中创建你的App中使用到的类和相应方法,其中方法的实现用空方法即可(防Crash),如果有使用到extern的外部变量,则需要在新工程的实现文件中初始化。
- 修改编译配置项,以缺少i386-framework类型库为例:
【Build Settings】
中【Mach-O Type】
类型选中Static Library
,【Build Active Architecture Only】
设为YES
,【Valid Architectures】
使用默认设置为[arm64 armv7 armv7s]
,编译时选择模拟器iPhone5
(因为i386是32位,已知iPhone5及其以下为32设备)。 - build工程,build成功后在Product目录选择xxx.framework或xxx.a,右键在finder中打开,将该xxx.framework或xxx.a和你App工程中的xxx.framework或xxx.a进行合并,采用命令
lipo -create xxx1 xxx2 -output xxx
即可,特别注意framework合并时用的是xxx.framework下的xxx文件进行。