RE: unimplemented methods
RE: unimplemented methods
- Subject: RE: unimplemented methods
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Tue, 22 Jul 2003 13:09:05 -0400
I just learned how to do this myself. As others have mentioned, you'll want
to implement forwardInvocation. You'll also need to
implement -methodSignatureForSelector. There's a good example of code for
f-orwardInvocation in the docs, but not for -methodSignatureForSelector.
The following pair of methods worked for me.
- (void)forwardInvocation:(NSInvocation *)invocation
{
if ([friend respondsToSelector:[invocation selector]])
[invocation invokeWithTarget:friend];
else
[self doesNotRecognizeSelector:aSelector];
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [friend methodSignatureForSelector:aSelector];
}
Jonathan
>
-----Original Message-----
>
From: email@hidden
>
[mailto:email@hidden]On Behalf Of Dylan Adams
>
Sent: Monday, July 21, 2003 9:03 PM
>
To: Ben Dougall
>
Cc: email@hidden
>
Subject: Re: unimplemented methods
>
>
>
Ben Dougall wrote:
>
> if an object receives a message, *any* message, that it has not got
>
> implemented, is there anyway for that object to kind of have a wildcard
>
> method that has the ability to deal with any unimplemented (in the
>
> object) message, particularly, know what the method call consisted of;
>
> method name and if any, passed variables?
>
>
Check out the forwardInvocation: method on the NSObject object (not the
>
NSObject protocol).
>
>
dylan
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.