When creating a static library (as required by iOS), one of the problems you will encounter is including characters from categories in this library so that they can be used by the application. The -ObjC linker -ObjC should contain enough information to include categories in these built-in frameworks, as Dave Dribin describes in his article here .
However, between iPhone OS 2.0 and 3.0, this stopped working correctly. As I mentioned in this answer , we ran into this problem in the Core Plot framework and found that we needed to add the linker flag -all_load to make the working environment correct. Apple itself posted the QA A QA1490 , which mentions this issue:
For applications with 64-bit and iPhone-OS, a linker error exists that prevents -ObjC from loading object files from static libraries that contain only categories and classes. The workaround is to use -all_load or -force_load.
-all_load forces the linker to load all object files from each archive being viewed, even without Objective-C code. -force_load is available in Xcode 3.2 and later. This allows you to control smaller grains loading the archive. Each -force_load option should be followed by the path to the archive and each object file in this archive will be downloaded.
Unfortunately, a side effect of this is that duplicate characters linked from several libraries can cause errors similar to the ones you experienced.
I published a bug report (back in 2009), and it seems that the latest version of LLVM, which is now used in Xcode, no longer suffers from this linker error. I tried using -ObjC with the goal of the Core Plot iOS static library, and now it works fine. This is welcome news.
Brad larson
source share