Bitcode是什么召娜?
找東西嘛粮揉,最先想到的當然是先看官方文檔了。在App Distribution Guide – App Thinning (iOS, watchOS)一節(jié)中眉反,找到了下面這樣一個定義:
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配置的程序將會在App store上被編譯和鏈接。bitcode允許蘋果在后期重新優(yōu)化我們程序的二進制文件,而不需要我們重新提交一個新的版本到App store上食绿。
嗯侈咕,看著挺高級的啊。
繼續(xù)看器紧,在What’s New in Xcode-New Features in Xcode 7中耀销,還有一段如下的描述
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會將程序編譯為一個中間表現(xiàn)形式(bitcode)铲汪。然后App store會再將這個botcode編譯為可執(zhí)行的64位或32位程序熊尉。
再看看這兩段描述都是放在App Thinning(App瘦身)一節(jié)中,可以看出其與包的優(yōu)化有關了掌腰。喵大(@onevcat)在其博客開發(fā)者所需要知道的 iOS 9 SDK 新特性中也描述了iOS 9中蘋果在App瘦身中所做的一些改進狰住,大家可以轉場到那去研讀一下。
Bitcode配置
在上面的錯誤提示中辅斟,提到了如何處理我們遇到的問題:
ou must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
要么讓第三方庫支持转晰,要么關閉target的bitcode選項。
在Xcode 7中士飒,我們新建一個iOS程序時查邢,bitcode選項默認是設置為YES的。我們可以在”Build Settings”->”Enable Bitcode”選項中看到這個設置酵幕。將其設為NO即可
不過扰藕,我們現(xiàn)在需要考慮的是三個平臺:iOS,Mac OS芳撒,watchOS邓深。
對應iOS,bitcode是可選的笔刹。
對于watchOS芥备,bitcode是必須的。
Mac OS不支持bitcode舌菜。