Bitcode簡(jiǎn)介
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.
蘋果官方對(duì)Bitcode的評(píng)價(jià)描述是钱慢,Bitcode是被編譯程序的一種中間形式的代碼。包含Bitcode配置的程序?qū)?huì)在App store上被編譯和鏈接爪模。目的是為了減少App的安裝包大小艇搀,使用戶不必下載不適合自己系統(tǒng)的那部分資源
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.
當(dāng)我們提交程序到App store上時(shí)萤彩,Xcode會(huì)將程序編譯為一個(gè)中間表現(xiàn)形式(Bitcode)。然后App store會(huì)再將這個(gè)Bitcode編譯為可執(zhí)行的64位或32位程序。
Bitcode配置
在實(shí)際開發(fā)中裹驰,需要考慮的是三個(gè)平臺(tái):iOS,Mac OS片挂,watchOS幻林。
- 對(duì)應(yīng)iOS,Bitcode是可選的音念。
- 對(duì)于watchOS滋将,Bitcode是必須的。
- Mac OS不支持Bitcode症昏。
方法一:更新library使包含Bitcode随闽,否則會(huì)出現(xiàn)以下中的警告;
(null): URGENT: all bitcode will be dropped because '/Users/myname/Library/Mobile Documents/com~apple~CloudDocs/foldername/appname/GoogleMobileAds.framework/GoogleMobileAds(GADSlot+AdEvents.o)'
was built without bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. Note: This will be an error in the future.
方法二:關(guān)閉Bitcode肝谭,在”Build Settings”->”Enable Bitcode”選項(xiàng)中看到這個(gè)設(shè)置掘宪。