Categories in static library for iPhone device 3.0

I have categories in my static library. Any application developer should set -ObjC flag to "Other Linker Flags" to use my static library properly. It works fine for iPhone device/iPhone Simulator 2.x and iPhone Simulator 3.0. But it crashes for iPhone device 3.0. As written in this article it is new linker bug. They suggest to use one more linker flag: -all_load. But when I add this flag, build fails too, because there are duplicate symbols.

How to use categories in static libraries for iPhone device 3.0? Any suggestions?


Solution 1:

We ran into the same problem (under 3.0, -ObjC no longer links in categories) within the Core Plot framework. All I can say is that for us, we were able to add the -all_load option to the Other Linker Flags within the target application and that did away with the runtime errors. We didn't see any warnings for duplicate symbols.

I've filed a bug report for the linker behavior, as I'm sure others have.

Solution 2:

Its a bug caused by trying to fix another bug with a hack. The -all_load fix for the category bug is a total hack.

See here for more.