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

Re: NSUndoManager.prepareWithInvocationTarget:


  • Subject: Re: NSUndoManager.prepareWithInvocationTarget:
  • From: Keary Suska <email@hidden>
  • Date: Sun, 10 May 2015 09:08:11 -0600

On May 10, 2015, at 7:07 AM, Charles Jenkins <email@hidden> wrote:

> Am I correct to believe there is NO way to use NSUndoManager.prepareWithInvocationTarget: if your undo method requires a parameter?
>
> I can use any method I want which has no parameter, but any method with parameters gets me the error “AnyObject does not have member named…”
>
> I thought about making a ClosureWrapper object which could have a parameterless method to call any method on a captured object, but since the invocation holds a weak reference, I think any instance of ClosureWrapper would be destroyed immediately after registration, so I didn’t bother trying.
>
> Right now I’m sticking with registerUndoWithTarget:selector:object:, but I’d like to know if there is a good way to use prepareWithInvocationTarget: instead.

As was indicated, -prepareWithInvocationTarget: is the precise method used anytime you have a single non-object parameter or multiple parameters. Chances are, the error that you are experiencing is due to stringing a bunch of selectors together with the period operator, which doesn't always work as you expect. In particular, although I am not up to date with compilers, I am pretty sure you (still) cannot use dot notation to invoke methods that take parameters, so you must use bracket syntax: [NSUndoManager prepareWithInvocationTarget: aTarget]

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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


References: 
 >NSUndoManager.prepareWithInvocationTarget: (From: Charles Jenkins <email@hidden>)

  • Prev by Date: Re: NSUndoManager.prepareWithInvocationTarget:
  • Next by Date: Outlets are nil after awakeFromNib call
  • Previous by thread: Re: NSUndoManager.prepareWithInvocationTarget:
  • Next by thread: Re: NSUndoManager.prepareWithInvocationTarget:
  • Index(es):
    • Date
    • Thread