Does anyone know the best way to check to see if an optional protocol method has been implemented.
I tried this:
if ([self.delegate respondsToSelector:@selector(optionalProtocolMethod:)] )
where delegate is:
id<MyProtocol> delegate;
However, I get an error saying that the function respondsToSelector: is not found in the protocol!
respondsToSelector:is part of theNSObjectprotocol. IncludingNSObjectinMyProtocolshould solve your problem: