NSDictionary 在调试中检查
我希望在调试操作期间查看我的 NSDictionary...最快和最好的方法是什么? xcode 没有像 Visual Studio 这样的手表来查看对象?
替代文字 http://www.ghiboz.info/shots/f1320fc6.png
谢谢!
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 objects?
alt text http://www.ghiboz.info/shots/f1320fc6.png
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以打开调试器(CMD+SHIFT+Y)选择您的字典实例,右键单击它并选择“在控制台中打印描述”。然后打开运行日志(CMD+SHIFT+R),您将看到词典的内容。不像VS中那么好,但我还没有找到其他方法。
屏幕截图
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 添加了以下功能,可能对您有所帮助。
现在您可以检查这些对象类型,而无需在控制台中打印整个对象。享受!
来源:http://developer.apple。 com/library/mac/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_6.html
XCode 4.6 has added the following functionality which may be helpful to you
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
最简单的方法是切换到控制台视图并输入“po myDictionary”。字典将以 NSLog 格式打印。
(“po”代表“打印对象”。要打印标量值,请执行“p someScalar”。打印
myDictionary.count
有点棘手:p (int) [myDictionary count]< /代码>。)
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]
.)