For some reason the compiler gives me a warning that my category methods may not be there (like "foobar may not respond to doFoo"). However, the category works.
views:
34answers:
1
+3
A:
Yes, you must import your category header file. Otherwise, the compiler will give a warning for any calls to methods defined in the category. This is exactly the same as when you call a method on a class, and the method is not defined.
Because of Objective-C's dynamic nature, at runtime it will still be able to find and execute the method you call, despite the compiler warning. That is why the warning is worded "foobar may not respond to doFoo". At compile time the compiler cannot find a declaration of the doFoo method, therefore it may not be able to call the doFoo method correctly, however at runtime the doFoo method may be called correctly.
CJ
2010-04-23 13:55:07