How do I disable the warning in xcode on a specific line?

advertisements

I've got a call like this [Class method] and a warning saying that Class may not respond to "method" message.

The "method" message does not indeed exist but my code use unknown message catching (using forwardingTargetForSelector) so it will run fine and it is build to run that way. How can I hide this annoying warning ?


If you intend to send a possibly-unimplemented message to an object, and you know that you're going to catch failures, you should use the invocation:

id myClone = [anObject performSelector:@selector(copy)];

That declares your intent more directly that you are calling a method that may not exist, and you're cool with that. This is a more clear way to do it than to suppress the warning or fake out the method.