Reputation: 364
If a message is sent to an object, but the object does not implement that method what is the next step?
Upvotes: 0
Views: 80
Reputation: 2830
You should call respondsToSelector:
on the object first to tackle that situation. That way you can handle cases where the object does not respond.
if([object respondsToSelector:@selector(method)]
{
//code here
}
else
{
//code here
}
Upvotes: 0
Reputation: 2227
you'll get an exception. it should tell you what the selector (message) is, so check to see whether you've misspelled it when you call the method, or when you declare the method in the object's class.
Upvotes: 0