Why does NSString not always display its text in the Xcode debugger?

This seems completely arbitrary, sometimes the NSString will display fine in the debugger:

 myStr  NSString *  0x0000000104e00040 @"Hello"

      

other times just:

myStr   NSString *  0x0000000104e00040

      

No problem with NSStrings, just how they appear in the debugger. Are there factors that affect this?

+3


source to share


3 answers


This is a bug in the IDE, I think I don't think we can do about it.

maybe stack depth influences this ... but that's guesswork.



a po MyStr

in the console always works fine :)

+4


source


You can also press Ctrl + click on the object and select "Print Description".



enter image description here

+4


source


for the case where po myString

doesn't work, it might be if you are filtering the console output in the IDE. for example, I filter for "myFunc" and then do po myString

. if it myString

does not contain the string "myFunc", it is not displayed. this also filters out the "Print Description" approach mentioned above.

I would argue that this is not the best behavior in the Xcode part, and it would be better if the filter was applied only to the program output and not to the debug process.

0


source







All Articles