iPhone Dev Tip #2: Static Libraries and Categories
August 23, 2010

So, you've just finished abstracting a bunch of your code but are getting a bunch of 'does not respond to selector exceptions. Of course, you've gotten no warning of these things, the code compiles fine, and you've done the normal stuff (like add -ObjC) to your linker flags.

So what gives? You've done everything right up until this point!

It turns out that apple has a problem with the current build of ldd. Therefore, you must do one of two things: add a small object interface and implementation in the same files as your category (this hints the compiler to look at the implementation) or add the -all_load flag in your linker flags.

Apple has a technote about this here: http://developer.apple.com/mac/library/qa/qa2006/qa1490.html And they also indicate that it's fixed in XCode 4 already so if you want to brave the new (buggy) XCode go for it!

This one took me a few hours to figure out so I hope it helps someone out there!

<<  Back