I'm starting to learn Objective C and I wonder if there is any similar function to actionscript trace 开发者_运维百科to show messages in a console.
Any suggestion?
Each called method has implicit self
(as object) and _cmd
(as SEL) parameters. Hence you can do this in Foo
class:
- (void)foo {
NSLog(@"-[%@ %@] custom log", self, NSStringFromSelector(_cmd));
}
This is off top of my head. And, of course there are various macros defined for such shortcut. The one I'm using is from here.
精彩评论