iOS9适配:Bitcode

Bitcode简介

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是被编译程序的一种中间形式的代码。包含Bitcode配置的程序将会在App store上被编译和链接。目的是为了减少App的安装包大小,使用户不必下载不适合自己系统的那部分资源

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位程序。

Bitcode配置

在实际开发中,需要考虑的是三个平台:iOS,Mac OS,watchOS。

  1. 对应iOS,Bitcode是可选的。
  2. 对于watchOS,Bitcode是必须的。
  3. Mac OS不支持Bitcode。

方法一:更新library使包含Bitcode,否则会出现以下中的警告;

(null): URGENT: all bitcode will be dropped because '/Users/myname/Library/Mobile Documents/com~apple~CloudDocs/foldername/appname/GoogleMobileAds.framework/GoogleMobileAds(GADSlot+AdEvents.o)'
 was built without 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. Note: This will be an error in the future.

方法二:关闭Bitcode,在”Build Settings”->”Enable Bitcode”选项中看到这个设置。

你可能感兴趣的:(iOS9适配:Bitcode)