Is it possible to know which function calls the current function in the objective-c?
for example, I have 100 functions give a call to function X. In the function X, are we able to define which function from 100 functions has already called?
Thanks.
Is it possible to know which function calls the current function in the objective-c?
for example, I have 100 functions give a call to function X. In the function X, are we able to define which function from 100 functions has already called?
Thanks.
I'm using a define directive :
#define CALLER_OF_METHOD NSLog(@"My Caller: [%@]", [[[[NSThread callStackSymbols] objectAtIndex:1] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[]"]] objectAtIndex:1])
please try, let me know if it's works for you chipbk10
if you dont want to write any code, put a break point in the function, then on the left it will show you the calling tree and you can see what functions were called in order to get to that breakpoint

Need to run application set break point in function X. When application stops at break points check functions in Debug navigator in xcode. you will know that which function called function X.See the sequence in below image.