Bitcode的使用


Bitcode刚出来的时候查过相关的文档,知道只要是iOS程序就把Enable Bitcode选择NO,因为那个时候第三方SDK都没有支持Bitcode包,也就没有细看,今天我们来看看什么是Bitcode以及它的用法。

Bitcode是什么

查看的官方文档,在APPDistribution Guide–App Thinning (iOS, watchOS)一节中,找到了下面这样一个定义:

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

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

而在What’s New in Xcode-New Features in Xcode 7中,还有一段如下的描述:

Bitcode. When you archive for submission tothe 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 bitexecutables as necessary.

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

再看看这两段描述,都是放在App Thinning(App瘦身)一节中,可以看出其与包的优化有关了。

Bitcode的使用

由上面的说明可以看出,Bitcode包的作用其实就是让苹果对我们的编译代码进行一次优化。

第三方库支持就是使用,不支持就选NO

实际上,在Xcode7中,我们新建一个iOS程序时,Bitcode选项是默认设置YES的。我们可以在Build settings —> Enable Bitcode选项中看到设置。

对于iOS,Bitcode是可选的,根据你对APP的要求已经第三方库的事情情况决定是否使用;对于watchOS,Bitcode是必选的;而Mac OS是不支持Bitcode的。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值