I am a objective C newbie. Why do i get a warning for calling a func i created in a category?
#import <stdio.h> #import <objc/Object.h> @interface MyObj: NSObject { @public int num; } -(void) print; @end @implementation MyObj; -(void) print { printf('%d\n', self->num); } @end @implementation MyObj(more) -(void) quack { printf('Quack\n'); } @end int main (int argc, char *argv[]) { MyObj *obj = [[MyObj alloc] init]; obj->num = 9; [obj print]; [obj quack]; //warning my not respond to quack [obj release]; }
You need to declare the interface for MyObj(more), eg.