I'm trying to use an NSInvocation
to invoke a superclass method from the subclass. The code involved is relatively straightforward, it goes like:
- (NSInvocation*) invocationWithSelector:(SEL)selector {
NSInvocation* call = [[NSInvocation alloc] init];
[call retainArguments];
call.target = super; //ERROR: use of undeclared identifier 'super'
call.selector = @selector(selector);
return call;
}
This seems a bit odd to me, as I had always assumed that super
followed pretty much the same rules as self
(i.e. it could be treated as a direct reference to the object in question and assigned to variables, used as a return value, etc.). It appears that this is not the case in practice.
Anyhow, is there any simple way to get my NSInvocation
to target the superclass implementation (I cannot use self
as the target, because the subclass overrides the superclass methods), or do I need to look for some other approach?