How to view contents of NSDictionary variable in Xcode debugger?

Question!

Is there a way to view the key/value pairs of a NSDictionary variable through the Xcode debugger? Here's the extent of information when it is fully expanded in the variable window:

Variable  Value      Summary
jsonDict  0x45c540   4 key/value pairs
 NSObject {...}
  isa     0xa06e0720

I was expecting it to show me each element of the dictionary (similar to an array variable).

By : Dara Kong


Answers

Click on your dict, then click on the little "i" icon, it should do the job :-) Xcode5, view the value of a dict

By : Taiko


XCode 4.6 has added the following functionality which may be helpful to you

The elements of NSArray and NSDictionary objects can now be inspected in the Xcode debugger

Now you can inspect these object types without having to print the entire object in the console. Enjoy!

Source: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_6.html

By : jkatzer


You can also use NSLog.

Also you can go in Debug area or xcode, then find out All Variables, Registers, Globals and Statics then select your variable. Right click on it. Then select Print description of "...."

Hope it helps!



This video can help you solving your question :)
By: admin