• 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: How does prepareWithInvocationTarget work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does prepareWithInvocationTarget work?


  • Subject: Re: How does prepareWithInvocationTarget work?
  • From: "Martin" <email@hidden>
  • Date: Mon, 08 May 2006 18:16:02 -0700

>I was calling prepareWithInvocationTarget and handing the undoManager a message with
>a long argument list.  Some arguments were NSObjects and some were primitive data types.
>(Is that allowed?)

Yes, that is definitely allowed.

>Forgive my objective-c ignorance but how is prepareWithInvocationTarget even possible?
>How does the undo manager know what to retain?

Basically when you call "prepareWithInvocationTarget" the NSUndoManager stops responding to all methods directly. The next message you send to it will not be recognized and the Objective-C runtime will call "forwardInvocation:". See:

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSObject.html#//apple_ref/occ/instm/NSObject/forwardInvocation:

At this point it can use NSInvocation's "retainArguments" method:

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSInvocation.html#//apple_ref/occ/instm/NSInvocation/retainArguments

~Martin

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Cocoa software design issue
  • Next by Date: ArrayController, CoreData & Bindings
  • Previous by thread: How does prepareWithInvocationTarget work?
  • Next by thread: frameworks
  • Index(es):
    • Date
    • Thread