I'm using a breakpoint with Action "Log Message", and I want to print the row of an NSIndexPath. So I tried: cell row @indexPath.row@
but nothing gets printed. I also tried using a debugger command: expr (void)NSLog(@"indexPath row:%i", indexPath.row)
but I get an error: error: property 'row' not found on object of type 'NSIndexPath *'
What am I doing wrong?
The dot syntax is just syntactic sugar added by the compiler. I've always disagreed with adding it to Objective-C, but some people love it. What you have to remember is that these dots are getting converted into method calls by the compiler, so when you message something directly, like in the debugger, you must use the actual method call. Try rewriting your expression:
expr (void)NSLog(@"indexPath row: %ld", (long int)[indexPath row])
I'm not sure if the debugger's basic log method will execute method calls like this, so you may have to use the expression type.
I think this is a special case. The code below will work, but only if row
is initialised to some value.
(lldb) print (NSInteger)[indexPath row]
I think this might be related to the fact that the row property is an extension of NSIndexPath in UIKit and is implemented as a category on that class.
Try to set this summary format in Xcodes variable view:
section:{(int)[$VAR section]},row:{(int)[$VAR row]}