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

Re: null selector


  • Subject: Re: null selector
  • From: Nick Zitzmann <email@hidden>
  • Date: Wed, 14 Sep 2005 07:57:45 -0600


On Sep 14, 2005, at 5:48 AM, Keith Alperin wrote:

- (void)awakeFromNib {
SEL *handlerSelector = @selector(someMethod: otherArg:);
NSMethodSignature *signature = [self methodSignatureForSelector: handlerSelector];
NSInvocation *handler = [NSInvocation invocationWithMethodSignature: signature];
[handler setTarget:self];
[handler retain];
int *someArg = 1;
int *otherArg = 2;
[handler setArgument:&someArg atIndex:2];
[handler setArgument:&otherArg atIndex:3];
[handler invoke];
}

1. The selector shouldn't be defined as a pointer. Neither should those two integers.
2. You forgot to call [handler setSelector:handlerSelector].
3. Why are you retaining the invocation? The program leaks memory if you do that unless you counter it with a release, but in this case, retaining the invocation isn't necessary.


Nick Zitzmann
<http://www.chronosnet.com/>


_______________________________________________ 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: 
 >null selector (From: Keith Alperin <email@hidden>)

  • Prev by Date: Re: null selector
  • Next by Date: Re: Cocoa for small applications
  • Previous by thread: Re: null selector
  • Next by thread: Re: null selector
  • Index(es):
    • Date
    • Thread