» 首頁 » 討論區 » iOS程式討論 »XCode 7 遇到 Bitcode 錯誤的解決辦法

XCode 7 遇到 Bitcode 錯誤的解決辦法

發表人: Seachaos
積分: 2432
發表時間: 2015-09-20 05:07:36
最近Apple Release了 XCode 7
如果在開發iOS的APP 有遇到類以下的錯誤:

[sea:linuxCode]
ld: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/dylib1.o'
does not contain 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.
for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[/sea]


那就是遇到了BITCODE的問題了

解決辦法很簡單,就是關掉他,方法如下圖
(到專案的 Build Settings ,搜尋 bitcode)
Image
將bitcode關掉

BitCode是什麼呢?
Apple的官網說明來看

他是一個有點像是Java Bytecode一樣的東西
但他是給LLVM (Apple的編譯器)用的,簡單的說就是Apple希望你可以在上傳到App Store時也一起上傳Bitcode,好處就是App Store可以幫你針對不同的 iOS 設備去優化你的App,不用重新上傳或是針對CPU做編譯

但會出現以上的錯誤可能就是因為用了沒有Bitcode的Library(通常是C++或是第三方的套件)
所以XCode在產生Bitcode就會失敗了
目前看來Bitcode比較適用於純 Swift 或是Objective-C的專案

同步發表於程式植物園