How do you call a method for an Objective-C object's superclass from elsewhere?
cocoa, iphone, objective-c, overriding, superclass
Solution
A more pleasant option (for debugging) is to add a category method which does it for you:
- (void) callSuperMethod { [super overriddenMethod]; }
The fact that there’s no more convenient way to do this is very much by design.
Problem
If you're implementing a subclass, you can, within your implementation, explicitly call the superclass's method, even if you've overridden that method, i.e.: ``` [self overriddenMethod]; //calls the subclass's method [super overriddenMethod]; //calls the superclass's method ``` What if you want to call the superclass's method from somewhere outside the subclass's implementation, i.e.: ``` [[object super] overriddenMethod]; //crashes ``` Is this even possible? And by extension, is it possible to go up more than one level within the implementation, i.e.: ``` [[super super] overriddenMethod]; //will this work? ```