understanding Xcode debugger var display

后端 未结 2 1658
死守一世寂寞
死守一世寂寞 2020-12-16 02:17

newbie question: can anyone tip me to how to understand/interpret what is displayed in the debugger var pane?

Ex: I am passing an NSDictionary as a method param. I s

相关标签:
2条回答
  • 2020-12-16 03:08

    Right click the variable, click "Edit Summary Format" and type the following:

    {(NSString*)[$VAR description]}:s
    

    This replaces the GDB formatter for NSDictionary with a call to the more expensive description method.
    That is, instead "x key/value pairs", you'll see the contents of the dictionary as produced by -[NSDictionary description].

    This is the same as typing po dictionary in the console window. Or right clicking the variable and choosing "Print Description". Both of them call the description method of the object.


    If you are curious, you can find this formatter at /Developer/Library/Xcode/CustomDataViews/Foundation.plist under the key NSDictionary. What you type as replacement is saved in /Users/USERNAME/Library/Developer/Xcode/UserData/Debugger/CustomDataFormatters and will persist across runs until you delete that file.

    A NSDictionary is really a class cluster and few people know the inside structure. At this point you ain't going to find much use for that debugger tree.

    0 讨论(0)
  • 2020-12-16 03:17

    This is what you are looking for : Click on your dict, then click on the little "i" icon :-) Xcode5, view the value of a dict

    0 讨论(0)
提交回复
热议问题