iOS: Categories in a Static Library Not Working?
Grrr…if you have category methods in a static library and those methods don’t seem to exist at runtime (unrecognized selector sent to class 0x...
), first make sure that your project target is passing the -ObjC
flag to the linker (in Other linker flags
). If that doesn’t fix the issue, change the -ObjC
flag to -all_load
. Details from Apple in this Technical Q&A.
You might also try using nm
to see if your category methods are being properly compiled into your .o
file. If they are, next invoke nm
on your application binary. If they exist in the binary, the linking is happening properly and you’re likely just misspelling the method name or something or that sort.