隨着 Xcode7的面世,咱們都清楚的知道,他能夠不經過https://developer.apple.com中的測試證書就能夠真機測試了,對於咱們開發者來講這是一個很好地事情,可是也會出現一些問題。xcode
咱們在作項目的時候,或多或少的會用的到第三方類庫,那麼問題來了,當你用 xcode在真機(iOS 8.3)上運行一下工程,結果發現工程編譯不過。看了下問題,報的是如下錯誤:app
ld: ‘/Users/**/Framework/SDKs/PolymerPay/Library/mobStat/lib**SDK.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 arm64ide
看警告能夠獲得的信息是"引入的一個第三方庫不包含bitcode"。 嗯? bitcode 是神馬東西呢?測試
好吧 咱們去查詢一下API 吧,終於找到了優化
在 Distribution Guide–App Thinning (iOS, watchOS) 一節中,找到了:ui
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.this
說的是bitcode是被編譯程序的一種中間形式的代碼。包含bitcode配置的程序將會在App store上被編譯和連接。bitcode容許蘋果在後期從新優化程序的二進制文件,而不須要從新提交一個新的版本到App store上。spa
還有在What’s New in Xcode-New Features in Xcode 7中,還有一段以下的描述:code
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.blog
當提交程序到App store上時,Xcode會將程序編譯爲一箇中間表現形式(bitcode)。而後App store會再將這個botcode編譯爲可執行的64位或32位程序。
可到這裏,我仍是不太明白是神馬意思,經過查閱相關資料,得出的結論是 這個東西應該和包得優化有關。
出現問題,咱們要想辦法解決它
在上面的錯誤提示中,提到了如何處理咱們遇到的問題:
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
意思就是說:要不你第三方類庫支持 bitcode 要不你就關掉它
好吧,咱們只能選擇後者了
咱們來看看他在那裏?
新建一個工程,咱們能夠在」Build Settings」->」Enable Bitcode」選項中看到這個設置。固然我這裏是改過的,其實新建的 xcode 工程 bitcode 是默認打開的!
好了改爲 NO 就能夠真機測試了!要是打包沒有改成 NO 的話.再上傳包的時候是能夠看到這個選項的,截圖我就不發了。