How can I register the current line via NSLog in Cocoa / Objective C?

Is it possible to register the current line number with NSLog in Cocoa / Objective C?

This is what I thought I should be doing:

NSLog(@"current line: %@ and value: %@",__LINE__,abc);


And i get Thread 1: Program Received Signal: "EXC_BAD_ACCESS"


source to share

1 answer

The macro __LINE__

provides an integer, so you need to change the format string. Instead, %@

you will need %d


NSLog(@"current line: %d",__LINE__);




All Articles