Warning “may not respond to” in Objective-C

comfy chair
put him in the comfy chair

If you are new to Objective-C , this one will get you pretty much as soon as you veer off the beaten track of sample code or the ever present temptation of “cut’n’paste” that we all fall prey to when getting some simple apps going in a new environment. You’ll probably bang your head against your snazzy bluetooth connected keyboard for a while until you remember that no-one expects the Spanish Inquisition and you’ve been spoiled for too long sitting in the comfy chair-like coding environments of your scripting languages, and that in fact, in C, you need to declare your methods/functions before you call them. Damn!

So, the easiest way to get rid of the warning to move the method being called above the method doing the calling.

Alternatively, you can essentially declare private methods at the top of your .m file

@interface MainViewController ()
- (void) NoMoreWarnings;