Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to verify if a delegate responds to a selector?

I know I need to write:

 [delegate respondsToSelector:@selector(myMethod:)]

But the compiler is complaining that respondsToSelector is not a method in the protocol, which is correct, However I have seen many sample code use this, how do you do it?

like image 325
Oscar Gomez Avatar asked Sep 11 '25 10:09

Oscar Gomez


1 Answers

Your @protocol needs to implement <NSObject>, simply update your protocol definition to look like this:

@protocol MyProtocol <NSObject>
like image 72
Greg Martin Avatar answered Sep 13 '25 00:09

Greg Martin