顯示具有 XCode 標籤的文章。 顯示所有文章
顯示具有 XCode 標籤的文章。 顯示所有文章

2016年6月26日 星期日

iOS 模擬器 couldn't be completed. (LaunchServicesError ... 解法



如果有使用 CocoaPods 的 XCode 專案,有時候會遇到一些鬼打牆的問題
例如 無緣無故忽然間就出現什麼 /bin/sh exit code 1
或是

The operation couldn't be completed. (LaunchServicesError error 0.)



Command /bin/sh failed with exit code 1

還是不能 copy 什麼 framework,出現 exit code 之類的

都有可能是專案沒有 Clean 乾淨 ( 一般的 Product -> Clean 可能無效)
這時候要按 Alt ,再選一次 Product -> Clean Build Folder ( 隱藏功能)
就有可能變正常了


2015年9月20日 星期日

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


最近Apple Release了 XCode 7
如果在開發iOS的APP 有遇到類以下的錯誤:



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)

那就是遇到了BITCODE的問題了

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

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

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