I have a class that declares and implements this :
- (void) callbackme:(OneClass*)p1 error:(NSString*)errStr {
}
and that calls in an instance method :
[self.obj oneAction:@"a string" sendAnswerToObject:self]; // obj is a custom class
in oneAction method of the custom class, I have :
- (void) oneAction:(NSString*)p1 sendAnswerToObject:(id)listener {
if (listener != nil && ![listener respondsToSelector:@selector(callbackme::)])
NSLog(@"Listener does not respond to selector 'callbackme:error:'");
}
The NSLog is triggered and I don’t understand why ?
The listener must be an id as it can be any object instance of any class.
Your if should be
just as the log you created.