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

Re: self and _cmd


  • Subject: Re: self and _cmd
  • From: Chris Kane <email@hidden>
  • Date: Wed, 5 Sep 2001 14:06:35 -0700

On Wednesday, September 5, 2001, at 05:36 AM, Ondra Cada wrote:
Rob Rix (RR) wrote at Wed, 5 Sep 2001 02:17:15 -0400:
RR> Just recalling how the runtime sends implicit arguments to methods: self
RR> and _cmd. Well, we all know how useful self is, but has anybody done
RR> anything useful/cool with _cmd?

-(void)notWorthUsingNSTimer {
...
[self performSelector:_cmd withObject:nil afterDelay:delay];
}

Ha! the implementation will show you what's not worthwhile. :-)

-performSelector:withObject:afterDelay: simply creates an NSTimer and schedules it. Or CFRunLoopTimer, I forget which nowdays, but it's the same thing.


The odd thing about this example is that you're scheduling "notWorthUsingNSTimer" to execute later, which is probably not what you want, since it'll apparently result in an infinite, if slowly, and "out-of-bandedly", executed, loop. :-)


Chris Kane
Cocoa Frameworks, Apple


  • Prev by Date: Re: address of method in a class instance
  • Next by Date: -[NSUserDefaults initWithUser:] broken?
  • Previous by thread: Re: self and _cmd
  • Next by thread: Re: self and _cmd
  • Index(es):
    • Date
    • Thread