• 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 driving me nuts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSInvocation driving me nuts


  • Subject: Re: NSInvocation driving me nuts
  • From: "Pontus Ilbring" <email@hidden>
  • Date: Sat, 8 Apr 2006 14:02:36 +0200

On 4/8/06, Pierre Bernard <email@hidden> wrote:
> Can you spot the difference between:
>
>                 [delegate _managedObjectContextEditor:self
>                                                                         didCommit:YES
>                                                                   contextInfo:contextInfo];
>
> and this:
>
>                 SEL selector = @selector
> (_managedObjectContextEditor:didCommit:contextInfo:);
>                 NSInvocation *invocation = [NSInvocation
> invocationWithMethodSignature:[delegate
> methodSignatureForSelector:selector]];
>                 BOOL success = YES;
>
>                 [invocation setTarget:delegate]; // 0
>                 [invocation setSelector:selector]; // 1
>                 [invocation setArgument:&self atIndex:2];
>                 [invocation setArgument:&success atIndex:3];
>                 [invocation setArgument:&contextInfo atIndex:4];
>                 [invocation retainArguments];
>                 [invocation invoke];
>
>                 [invocation release];
>
> Well, the first one works. The second does not!

You never retain your invocation -- only its arguments, and then you
call release on it.
 _______________________________________________
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

References: 
 >NSInvocation driving me nuts (From: Pierre Bernard <email@hidden>)

  • Prev by Date: Re: Unable to link universal binary
  • Next by Date: Re: NSInvocation driving me nuts
  • Previous by thread: NSInvocation driving me nuts
  • Next by thread: Re: NSInvocation driving me nuts
  • Index(es):
    • Date
    • Thread