Display the value of a variable property in LLDB debugger?

前端 未结 3 1452
感情败类
感情败类 2020-12-24 15:40

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 printe

3条回答
  •  抹茶落季
    2020-12-24 16:23

    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.

提交回复
热议问题