iOS打包錯誤

ld: bitcode bundle could not be generated because '/Users/YzsComPuter/Desktop/IOS_KTV/ktv_ios/BaiduMapAPI_Location.framework/BaiduMapAPI_Location(BMKLocationService.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

如果打包出現(xiàn)上述類似的錯誤,只需在build setting 里搜索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是被編譯程序的一種中間形式的代碼。包含bitcode配置的程序將會在App store上被編譯和鏈接。bitcode允許蘋果在后期重新優(yōu)化程序的二進制文件,而不需要重新提交一個新的版本到App store上。

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

Bitcode配置

     在上面的錯誤提示中,提到了如何處理我們遇到的問題:

You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE www.maiziedu.com), 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”選項中看到這個設置。不過,我們現(xiàn)在需要考慮的是三個平臺:iOS,Mac OS,watchOS。

對于iOS,bitcode是可選的;對于watchOS,bitcode是必須的;而Mac OS是不支持bitcode。

    所以,如果我們的工程需要支持bitcode,則必要要求所有引入的第三方庫都支持bitcode。
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容