View NSString length in debugger

I have an NSString variable called myText . How to watch [myText length] in xcode debugger?

+6
source share
2 answers

You can use the debugger console to evaluate the properties of an object in Xcode, the output of the debugger output also functions as input.

Example output

Obviously, you first need to hit the breakpoint ...

It really works with GDB and LLDB, and you need to enter the output console:

 print (int)[myText length] 
+4
source

In addition to the @aleroot solution, you can also use the debugger variable view. You can right-click on the view and select "Add Expression" and enter whatever you want to control. This is a bit cumbersome compared to @aleroot's solution, but the advantage of this method is that it automatically displays again the next time you click the same breakpoint.

enter image description here

+3
source

Source: https://habr.com/ru/post/917717/


All Articles