了解Xcode Bitcode

官方:
Bitcode is an intermediate representation of a compiled program. apps you upload to App Store 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 App Store.
For iOS apps, bitcode is the default, but optional. For watchOS and tvOS apps, bitcode is required. If you provide bitcode, all apps and frameworks in the app bundle (all targets in the project) need to include bitcode.

翻译:
Bitcode是编译后的程序的中间表现,包含Bitcode并上传到App Store Connect的Apps会在App Store上编译和链接。包含Bitcode可以在不提交新版本App的情况下,允许Apple在将来的时候再次优化你的App 二进制文件。
对于iOS Apps,Enable bitcode 默认为YES,是可选的(可以改为NO)。对于WatchOS和tvOS,bitcode是强制的。如果你的App支持bitcode,App Bundle(项目中所有的target)中的所有的Apps和frameworks都需要包含Bitcode
 
  当使用Archive方式打包出带有bitcode的包时,你会发现这个包里的二进制文件比没有开启bitcode时大出了许多,多出来的其实就是bitcode的体积。这部分内容并不会导致用户下载到的APP变大,因为用户下载到的代码中只会有机器码,不会包含bitcode。
 
  有的项目开启bitcode之后会发现二进制的体积增大到超出了苹果对二进制体积的限制,但是完全不用担心,苹果的限制只是针对__TEXT 段,而嵌入的bitcode是存储在单独的__LLVM 段,不在苹果的限制范围内。
 
posted @ 2020-06-03 10:44  何文西  阅读(343)  评论(0编辑  收藏  举报