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

Re: Current Selector


  • Subject: Re: Current Selector
  • From: Greg Titus <email@hidden>
  • Date: Mon, 6 Jan 2003 14:52:10 -0800

There is a hidden local variable in every method called "_cmd", which is the current selector. This is similar to "self", but much less commonly used. :-)

So you could just do something like:
NSLog(@"executing %@", NSStringFromSelector(_cmd));

Hope this helps,
- Greg

On Monday, January 6, 2003, at 02:35 PM, Ted Lowery wrote:

Is there a way, programmatically, to get the name of the current selector (method) that is executing? I'm trying to log some debugging info, and I'd like to be able to indicate the selector without having to write a custom like of code for each method.

Cheers, Ted
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Current Selector (From: Ted Lowery <email@hidden>)

  • Prev by Date: Re: porting apps from NextStep to Cocoa
  • Next by Date: Re: Current Selector
  • Previous by thread: Current Selector
  • Next by thread: Re: Current Selector
  • Index(es):
    • Date
    • Thread