Basic Objective-C question

This may be an idiotic question, but anyway... Is there a way to convince the compiler that an object responds to a selector?

In a lot of places in my program I take an object of a given class (e.g. Menu), determine its subclass (e.g. StatusMenu) and then call subclass-specific selectors. I've been careful to ensure that each call is preceded by a respondToSelector: check, but of course this doesn't satisfy the compiler and I get a warning. I've not got over 200 of these warnings and it's gotten to the point where I can't see "valid" warnings through all the noise.

Am I going about things entirely the wrong way here? How do you deal with this issue?

You can typecast your object to id or the subclass (e.g., StatusMenu), but if you're having to ask an object what class it is then there's probably something wrong with your design . You said there are a lot of places in your program that take an object of a given class, then ask if it's a given subclass - why not make those places take an object of the subclass, or if you do different things depending on the subclass, why not have different methods for each one?

I seem to remember that there is some way of silencing an individual warning, but can't remember how. In any case, you should avoid doing that as much as possible because sometimes even though you think the warning is bogus, you might have an assumption wrong and the code could actually be bad.

There's a compiler warning when calling appendString because NSString doesn't respond to that selector, only its subclass NSMutableString. Hence the suggestion to either typecast or change the method signature.