views:

290

answers:

2

Hello i have received this message ever since i started building my first iphone program several months ago. I check if a delegate implements a given method. It works but I get this warning. How can i do it the correct way? Thanks in advance.

+1  A: 

I suppose respondsToSelector is a method of NSObject, and I guess that you have something like id<MyProtocol> as the type? Try NSObject*<MyProtocol>.

Krumelur
+10  A: 

The respondsToSelector: method is declared in the NSObject protocol. You have to make sure that your custom protocols also conform to the NSObject protocol. Change the declarations of your custom protocols from:

@protocol MyCustomProtocol
...
@end

to:

@protocol MyCustomProtocol <NSObject>
...
@end
Ole Begemann
Thanks, it works
kudor gyozo

related questions