开发者

NSDictionary inspect in debug

开发者 https://www.devze.com 2023-01-04 16:52 出处:网络
I wish look inside my NSDictionary during my debug operation...what is the fastest and best way to do this?? xcode doesn\'t have a watch like visual studio to look the objec开发者_如何学JAVAts?

I wish look inside my NSDictionary during my debug operation...what is the fastest and best way to do this?? xcode doesn't have a watch like visual studio to look the objec开发者_如何学JAVAts?

alt text http://www.ghiboz.info/shots/f1320fc6.png

thanks!


you can open debugger (CMD+SHIFT+Y) select your dictionary instance, right click on it and choose "Print description in console". Then open run log (CMD+SHIFT+R) and you'll see the contents of your dictionary. Isn't so good as in VS, but I haven't find another way yet.
Screenshot


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


The simplest way is to switch to your console view and type "po myDictionary". The dictionary will be printed in NSLog format.

("po" is for "print object". To print a scalar value do "p someScalar". Printing myDictionary.count is a little trickier: p (int) [myDictionary count].)

0

精彩评论

暂无评论...
验证码 换一张
取 消