• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: unimplemented methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unimplemented methods


  • Subject: Re: unimplemented methods
  • From: Ben Dougall <email@hidden>
  • Date: Wed, 23 Jul 2003 03:25:09 +0100

thanks.
but do you have to have potentially catchable methods implemented in the covering, forwarded to object? or is it actually possible to catch any method call and glean all the information from that call (name + arguments)? like a final catch all net? is that what invocations and forwarding amount to, or not?

On Tuesday, July 22, 2003, at 06:09 pm, Jonathan E. Jackel wrote:

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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: unimplemented methods
      • From: publiclook <email@hidden>
References: 
 >RE: unimplemented methods (From: "Jonathan E. Jackel" <email@hidden>)

  • Prev by Date: Re: drawing while dragging
  • Next by Date: Re: Bug reports and documentation updates (was Re: Subclassing NSPort (or NSSocketPort))
  • Previous by thread: RE: unimplemented methods
  • Next by thread: Re: unimplemented methods
  • Index(es):
    • Date
    • Thread