Xcode 7 'CrashReporter does not contain bitcode' 链接器错误

Xcode 7 'CrashReporter does not contain bitcode' linker error

我在我的 iOS 应用程序中直接 linking PLCrashReporter,没有使用任何外部工具,现在当我尝试在 Xcode 7 上编译它时,我得到 link错误:

ld: '.../CrashReporter.framework/CrashReporter(libCrashReporter-iphoneos.a-armv7-master.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

我从哪里获得更新的框架或源代码以在启用 bitcode 的情况下编译它们并在不为整个项目禁用 bitcode 的情况下消除错误?

遇到了同样的问题。我使用源代码构建了崩溃报告器框架 https://www.plcrashreporter.org/code

  • 在Xcode
  • 中打开它
  • Select 'CrashReporter' 红色靶心的目标。
  • 建造它

然后在 ~/Library/Developer/Xcode/DerivedData/CrashReporter-xxxxxxx 中搜索以获取 .framework 包

我最终通过从源代码构建 PLCrashReporter 1.2.1 解决了这个问题。此版本是合并了 Xcode 7 和 iOS9 修复程序的最低版本。

来源从这里获取:PLCrashReporter 1.2.1

将下载的 1.2.1 源解压缩到一个文件夹中。

将该文件夹中的 Xcode 项目拉到 Xcode 中,并将以下内容添加到项目构建设置的自定义编译器设置 "Other C Flags" 部分:-fembed-bitcode

接下来将以下内容添加到项目构建设置的自定义编译器设置 "Other Warning Flags" 部分:-Wno-error=unused-command-line-argument

然后从 Xcode GUI 关闭项目。自定义设置是必要的,因为我们将使用 xcodebuild 从命令行构建以避免 PLCR 弃用错误,并且在这样做时,默认情况下只有 -fembed-bitcode-marker 以这种方式构建框架。我们正在覆盖默认行为,并且需要抑制由此导致的硬停止警告。

最后,在包含 xcode 项目文件的源 zip 文件所在的文件夹中,从终端 window 提示 运行 以下内容:

xcodebuild -configuration Release -target 'Disk Image'

这将 运行 构建并在 ./build/Release/PLCrashReporter-1.2.1/iOS Framework

中保留框架

现在,这些步骤将生成一个启用位码的框架,但第三方崩溃报告与位码不兼容(当 App Store 重新编译时,您无法从动态构建的那个中获取符号文件)。

有2个选项。
1. 下载 PLCrashReporter 源代码并在启用位码的情况下对其进行编译,并在您的项目中使用它。
2. 为你的目标禁用位码
转到目标的构建设置选项卡,搜索 Enable Bitcode 将值设置为 NO。

不幸的是,这个问题又出现了。此外,当我再次尝试编译时,我得到:

ld: warning: object file (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(cf.o)) was built for newer OSX version (10.6) than being linked (10.5) ld: warning: object file (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)) was built for newer OSX version (10.6) than being linked (10.5)

此外,如果我在项目级别设置启用位代码,我会立即收到错误消息: 目标 'CrashReporter-MacOSX-Static' 启用了位码(ENABLE_BITCODE = 是),但 'macosx' 平台

不支持它

我应该怎么做才能生成启用了位码的框架?

这对我有用,以便在我的项目中包含 Rollbar 框架:

在我的工作区内,我首先从 Project Navigator select 我的项目 -> 我的项目目标 -> 构建设置 -> 启用 Bitcode = NO

然后我 select PODS 来自项目导航器 -> Rollbar 目标 -> 启用位码 = NO