Previously, I’ve written about an issue with objective-c categories in static libraries. There is an Apple tech note which advises the following for iOS applications:
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.
The -all_load option will force the linker to load any object files from all libraries. In my opinion it is better to use the -force_load option. This option works similarly to the -all_load option, but it lets you specify the individual libraries to apply this behaviour to. This is useful, especially when you have many static libraries that are used to form your application binary and you know exactly which ones contain categories.
However, if you’re compiling with LLVM with this option you may run into an issue. With GCC, you specify the option under the Other Linker Flags of your project’s build settings. Therefore, the following would work:
-force_load $(BUILT_PRODUCTS_DIR)/libStaticLibrary.a
However, this option needs to be modified if you’re project is being compiled with LLVM. In order to pass options to the linker in LLVM you use the -Wl option for each library as follows:
-Wl,-force_load,$(BUILT_PRODUCTS_DIR)/libStaticLibrary.a


