關(guān)于Bitcode

  • 官方定義
    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配置的程序?qū)贏ppStore上被編譯和鏈接。允許蘋果在后期重新優(yōu)化程序的二進(jìn)制文件,而不需要重新提交一個新的版本到AppStore。

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

當(dāng)提交程序到App store上時,Xcode會將程序編譯為一個中間表現(xiàn)形式(bitcode)。然后App store會再將這個botcode編譯為可執(zhí)行的64位或32位程序。
再看看這兩段描述,都是放在App Thinning(App瘦身)一節(jié)中,可以看出其與包的優(yōu)化有關(guān)。

  • 出現(xiàn)的問題
    用Xcode 7 在真機(jī)(iOS 8.3)上運(yùn)行一下工程,結(jié)果發(fā)現(xiàn)工程編譯不過??戳讼聠栴},報的是以下錯誤:

    ‘/Users//Framework/SDKs/PolymerPay/Library/mobStat/libSDK.a(**ForSDK.o)’does not contain bitcode. You must rebuild it with bitcode enabled (Xcodesetting ENABLE_BITCODE), obtain an updated library from the vendor, or disablebitcode for this target. for architecture arm64

得到的信息是引入的一個第三方庫不包含bitcode。
在上面的錯誤提示中,提到了如何處理我們遇到的問題:

You must rebuild it with bitcode enabled(Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, ordisable bitcode for this target. for architecture arm64

要么讓第三方庫支持,要么關(guān)閉target的bitcode選項。

實際上,在Xcode 7中,我們新建一個iOS程序時,bitcode選項默認(rèn)是設(shè)置為YES的。我們可以在”Build Settings”->”Enable Bitcode”選項中看到這個設(shè)置。

所以,如果我們的工程需要支持bitcode,則必要要求所有引入的第三方庫都支持bitcode。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容