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. 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.

大概意思是bitcode是一种中间代码,app提交审核后会对app进行优化.如果支持bitcode,app store会对程序进行优化为支持32位版本或者是64位版本.

现在的APP需要支持bitcode,同时使用的第三方SDK也需要支持bitcode.Apple watch的app必须支持bitcode.

编译library时,需要在用xcode编译时需要添加参数:

xcodebuild OTHER_CFLAGS="-fembed-bitcode" -target ${target}

同时也需要将开源的第三方库重新进行编译

CFLAGS="-fembed-bitcode"

CFLAGS="-fembed-bitcode-marker"

当然,支持bitcode后,编译的.a体积会增大2-3倍,但是使用"-fember-bitcode-marker"编译的.a,体积不会有明显变化,而且编译的时候Enable Bitcode->YES也不会报错.

实际上"-fember-bitcode-marker"并没有使.a支持bitcode,支持添加了标记.建议如果是release版本,最好还是使用"-fember-bitcode",而且Archive也不会有问题(亲测).

目前国内很多SDK暂不支持bitcode,还有很多开源第三方库也不支持bitcode,需要自己重新编译.而且支持bitcode看是是一个大趋势,希望国内的多数SDK今早支持bitcode,方便开发者使用

 

posted @ 2016-02-04 15:02  shuffle  阅读(1702)  评论(0编辑  收藏  举报