【iOS】Xcode中的-all_load与-ObjC

在引入静态库时,通常需要在"Other Linker Flags"中添加-all_load和-Objc属性,注释如下:

IMPORTANT: For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags. -all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code. -force_load is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.

 

There is a side effect: build phase take much time.

-ObjC allow the static library to use objective-c specific stuffs like kvc or categories.

-all_load solve a bug in gcc/llvm, where -ObjC is not correctly used.

转自:“http://blog.csdn.net/workhardupc100/article/details/7350809”

posted on 2012-11-07 18:19  trako  阅读(334)  评论(0编辑  收藏  举报

导航