Search code examples
objective-cxcode4lldb

expr (void)NSLog(@"someString is %@", someString)


I've got this as a Debugger Action in a breakpoint:

expr (void)NSLog(@"someString is %@", someString)

but it's barfing with:

error: warning: expression result unused
error: cannot find interface declaration for '$__lldb_objc_class'
error: cannot find interface declaration for '$__lldb_objc_class'
error: 2 errors parsing expression

Why's it not working?

====
UPDATE

I tried this in a completely new Xcode project. And it works fine. So, to be clear, this line has no syntactical problems in Xcode 4.6:

expr (void)NSLog(@"someString is %@", someString)

However, copying the exact same line from the breakpoint to my previous Xcode project results in the same problem.

Could it be something I've changed in the Build Settings for this specific project?


Solution

  • Make sure that you are not reaching this code from within a block. This would explain why the same breakpoint works in a new project but not in the other. This is what happens when trying to print the value of objects while at breakpoints within blocks. The solution is to use an NSLog in the block to do the printouts rather than using breakpoints. It's annoying, I know.