How to get exact number of line from where the method called in iOS? -


i want exact number of line method being called.

i have single method called multiple line in command different different lines. so, need line being called in controller.

i have used following code stack overflow, passing me wrong line number:

nsstring *sourcestring = [[nsthread callstacksymbols] objectatindex:1];     // example: 1   uikit                               0x00540c89 -[uiapplication _callinitializationdelegatesforurl:payload:suspended:] + 1163     nscharacterset *separatorset = [nscharacterset charactersetwithcharactersinstring:@" -[]+?.,"];     nsmutablearray *array = [nsmutablearray arraywitharray:[sourcestring  componentsseparatedbycharactersinset:separatorset]];     [array removeobject:@""];      nslog(@"stack = %@", [array objectatindex:0]);     nslog(@"framework = %@", [array objectatindex:1]);     nslog(@"memory address = %@", [array objectatindex:2]);     nslog(@"class caller = %@", [array objectatindex:3]);     nslog(@"function caller = %@", [array objectatindex:4]);     nslog(@"line caller = %@", [array objectatindex:5]); 

so, how exact number of line method called in ios?

nslog((@"%s [line %d] "), __pretty_function__, __line__); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -