I have this inside a class
[delegate performSelector:@selector(doStuff:) withObject:myObject afterDelay:2.0];
and I am having this error
warning:
‘-performSelector:withObject:afterDelay:’
not found in protocol(s)
I cannot figure out what may be wrong.
any clues?
thanks.
Your problem is that you’ve declared your delegate instance variable as:
Right? Well, that means that the compile-time checker is only going to look for methods in the
<SomeProtocol>protocol. However,performSelector:withObject:afterDelay:is declared onNSObject. This means that you should declare the ivar as:This is saying that it must be an
NSObjectthat conforms to<SomeProtocol>, as opposed to any object that conforms to<SomeProtocol>. This should get rid of your warning, and you don’t have to do any casting.