How to get the name of a method at runtime?
How to get the name of a method at runtime?
- Subject: How to get the name of a method at runtime?
- From: Stuart Malin <email@hidden>
- Date: Sat, 8 Mar 2008 22:44:00 -1000
I'd like to have a method determine the name of the method that
invoked it -- as an NSString.
For example
- (void) method1 {
[someObject method2];
}
- (void) method2 {
// here, I'd like to be able to find the name of the caller
// in this example, that would be "method1"
}
I have a suspicion that this is either trivial, and I'm just missing
the obvious,
or its far from trivial and requires accessing the stack and some
symbol table.
Any pointers (no pun intended) as to where I can find more
information to understand the internal mechanisms would be appreciated.
_______________________________________________
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