关于 “does not contain bitcode.”的错误解决办法

Xcode7运行项目时出现了如下的错误:.

Xcode7运行项目时出现了如下的错误:

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是个什么鬼呢?

什么是 bitcode ?

通俗解释:在线版安卓ART模式。

Apple 官方文档– App Distribution Guide – App Thinning (iOS, watchOS) 是这样定义的:

Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.

翻译过来就是:

bitcode 是被编译程序的一种中间形式的代码。包含 bitcode 配置的程序将会在 App Store 上被编译和链接。 bitcode 允许苹果在后期重新优化我们程序的二进制文件,而不需要我们重新提交一个新的版本到 App Store 上。

在 Xcode简介— What’s New in Xcode-New Features in Xcode 7 中这样描述:

Bitcode. When you archive for submission to the App Store, Xcode will compile your app into an intermediate representation. The App Store will then compile the bitcode down into the 64 or 32 bit executables as necessary.

也就是

当我们提交程序到 App Store上时, Xcode 会将程序编译为一个中间表现形式( bitcode )。然后 App store 会再将这个 bitcode 编译为可执行的64位或32位程序。

请看这里 http://blog.csdn.net/soindy/article/details/48518717

如果你的应用也准备启用 Bitcode 编译机制,就需要注意以下几点:

Xcode 7默认开启 Bitcode ,如果应用开启 Bitcode,那么其集成的其他第三方库也需要是 Bitcode编译的包才能真正进行 Bitcode 编译

开启 Bitcode 编译后,编译产生的 .app 体积会变大(中间代码,不是用户下载的包),且 .dSYM文件不能用来崩溃日志的符号化(用户下载的包是 Apple 服务重新编译产生的,有产生新的符号文件)

通过 Archive 方式上传 AppStore 的包,可以在Xcode的Organizer工具中下载对应安装包的新的符号文件

出现的问题原因是什么呢?

原来是某些二进制库不支持bitcode.而Xcode默认是要支持bitcode的,而且如果支持的话,其中所有的二进制库和framework都必须包含bitcode.

怎么样解决呢?

我们可以直接将bitcode直接关掉就可以了。target —> Built Seeting —>搜索 bitcode —>将Yes置为No
———————
作者:ismilesky
来源:CSDN
原文:https://blog.csdn.net/ismilesky/article/details/50721365
版权声明:本文为博主原创文章,转载请附上博文链接!