I’m receiving the following warning:
Instance method 'method name' not found (return type defaults to 'id')
when this code is invoked:
@protocol SomeProtocol <NSObject> {
@property (nonatomic, retain) SpecificClassName* someDelegate;
}
...
+ (void) aMethod : (id <SomeProtocol>) object {
[object.someDelegate doSomeThing]; // warning statement show up here
}
I feel like this is a short coming of the compiler at this point, but that just may be the pot calling the kettle black … does anyone have any feedback on this?
You need to
#importthe header file forSpecificClassName, in your implementation (.mfile).If you’re going to use the type name
SpecificClassNamein the header file, a forward declaration@class SpecificClassNamewill do, but calling a method on the class requires the compiler to know the return type of the method.If you want to call a method on an instance of
SpecificClassName, include the header in which it’s defined.