這個 bug 在 xcode 4.3 以下會出現,4.3 以后已經修正了。
解決方法為:找到 target 的圖標,更改其 Other Linker Flags 為: -all_load 或 -force_load
-force_load,后跟隨一個文件位置,可以更精確地加載所需文件。
蘋果的解釋為 :
http://developer.apple.com/library/mac/#qa/qa1490/_index.html簡單點說就是,Objective-C 的動態特性使得需要,為鏈接器添加一個標簽(設置 Other Linker Flags 為 -ObjC)來解決通過 Category 向類添加方法的問題。
但這個標簽 -ObjC 在 64 位 和 iOS 中有問題,需要使用 -all_load 或 -force_load。
總結如下:
如果,第三庫中沒有 category,Other Linker Flags 無需設置
如果,第三方庫中有 category,需要設置為 -ObjC
如果,某些 Xcode 版本中,出現問題,修改設置為 -all_load
posted on 2012-04-23 14:56
lincode 閱讀(1818)
評論(0) 編輯 收藏 所屬分類:
ios