• 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: NSInvocation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSInvocation


  • Subject: Re: NSInvocation
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 10 Sep 2008 10:13:31 -0500

On Sep 10, 2008, at 9:52 AM, Michael Ash wrote:

On Wed, Sep 10, 2008 at 2:56 AM, Chris Idou <email@hidden> wrote:

I have a need to call performSelector:withObject etc, except I need to pass 3 arguments. The doco to performSelector:withObject:withObject says to "See NSInvocation", which I have done, but I don't understand how to use it. Can anyone give me some code which implements performSelector:withObject etc as example?

Ignore the docs. NSInvocation is inconveniently difficult and slow. Instead use methodForSelector:. This gives you a function pointer which you can then call easily using C.

[...]

And lastly, I recommend filing a bug against the documentation in this
case. NSInvocation is not really suited for this particular task, and
I don't understand why they would recommend it here.

One possible reason is for proxying or otherwise handling unimplemented methods dynamically. There is a well-defined mechanism for what happens if you send a message to an object that doesn't directly implement a method for that message. A class can decide to forward the message, or it can do something funky in an override of doesNotRecognizeSelector:. That mechanism does kick in for performSelector:… and NSInvocation but doesn't for methodForSelector:.


Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSInvocation
      • From: "Michael Ash" <email@hidden>
References: 
 >NSInvocation (From: Chris Idou <email@hidden>)
 >Re: NSInvocation (From: "Michael Ash" <email@hidden>)

  • Prev by Date: EPS
  • Next by Date: HTTP chunked transfer encoding implementation
  • Previous by thread: Re: NSInvocation
  • Next by thread: Re: NSInvocation
  • Index(es):
    • Date
    • Thread