编译启用了bitcode的iOS库

Yot*_*tam 9 frameworks ios bitcode

我需要释放一个启用了bitcode的框架,结果很麻烦.我将项目设置中的"启用Bitcode"设置为"YES",它可以为真实设备和模拟器进行干净的构建.

我想测试库,所以我将它集成到我为此目的创建的新应用程序,但现在它只为模拟器构建.当我尝试为真实设备构建时,我得到:

ld: '/path/to/Framework.framework/Company(File.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

就像我说的,我用Bitcode启用了它,所以我不确定为什么会这样.

有任何想法吗?谢谢

Ale*_*sov 20

AFAIK,当您使用Xcode构建应用程序时,它仅在您进行存档时包含Bitcode,原因是 - 只需要调试或测试应用程序/库时减少编译时间.

为了确保在Xcode的每个发射位码筹建你可以添加-fembed-bitcode标志Other C flagsOther linker flags:

在此输入图像描述

在此输入图像描述

此外,检查二进制文件是否包含bitcode的最简单方法是使用otoolgrep:

otool -l binary_name | grep __LLVM

你会看到一个或多个segname __LLVM条目,如果它有bitcode或空输出,如果没有.

  • `__LLVM`段的存在并不能证明Bitcode也存在.还有其他具有该名称的段,这些段不包含bitcode.更好的grep为`__bitcode`. (7认同)