Is there any way that I can list all called methods like there are called one after the other? For example now I am doing same thing in way that I'm putting NSLog(@"MethodName"); i every that method. I want to do that by automatic way in NSLog. Is it possible?
Asked
Active
Viewed 114 times
-1
-
Take a look at here: http://stackoverflow.com/questions/7270502/how-to-log-all-methods-used-in-ios-app – Attila H Jan 17 '13 at 15:32
-
Not helped. App stops... – iWizard Jan 17 '13 at 15:39
-
It works, jsut read carefully. :) – Attila H Jan 17 '13 at 15:40
-
1It supposed you confuse "Condition" field in breakpoint popover with "Action" field. Paste this code `expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )` in "Action->Debugger Command" field. It works, I've checked. – Rostyslav Druzhchenko Jan 17 '13 at 15:59
3 Answers
1
If you don't have too much methods you can use
NSLog(@"%@" , NSStringFromSelector(_cmd));
to log their names. This way you don't have to copy the signatures manually each time.

Attila H
- 3,616
- 2
- 24
- 37
-
1I believe `NSLog(@"%s", __func__);` will be better in this case 'cause it logs class's name too. – Rostyslav Druzhchenko Jan 17 '13 at 16:01
1
Create a property 'NSMutableArray *calledMethods;`
And in each of your method use
[self.calledMethods addObject:NSStringFromSelector(_cmd)]
;
And whenever you want to print it NSLog it.

Anoop Vaidya
- 46,283
- 15
- 111
- 140
1
I think you want:
printf("%s\n", __PRETTY_FUNCTION__ ) ;
Which produces (for example)
-[AppDelegate application:didFinishLaunchingWithOptions:]
Or, you can use dtrace. This answer should help: https://stackoverflow.com/a/3874726/210171.
Also check https://stackoverflow.com/a/4604249/210171 (same linked question). Seems there's an environment variable NSObjCMessageLoggingEnabled
you can set...