Re: Forwarding and forwardInvocation
Re: Forwarding and forwardInvocation
- Subject: Re: Forwarding and forwardInvocation
- From: John Hörnkvist <email@hidden>
- Date: Wed, 19 Sep 2001 19:19:15 +0200
On Wednesday, September 19, 2001, at 06:48 PM, Richard Schroedel wrote:
I am trying to use forwardInvocation. Unfortunately the object that
declares it never receives control at it's forwardInvocation method.
Instead I just get the usual "undefined method" error message. Any
ideas out there?
You must implement methodSignatureForSelector:.
- (NSMethodSignature*)methodSignatureForSelector;(SEL)selector
{
NSMethodSignature* signature =[super
methodSignatureForSelector:selector];
if (! signature)
signature =[delegate methodSignatureForSelector;selector];
return signature;
}
The runtime uses the method signature to collect the arguments from the
stack and register state.
Hardcore Objective-C programmers that want to collect the arguments
manually or do return value magic can do so by overriding forward::
instead.
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com