如何从Xcode 4中的断点动作打印字符串值? [英] How to print string value from breakpoint action in Xcode 4?

查看:171
本文介绍了如何从Xcode 4中的断点动作打印字符串值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个断点操作,并从下拉列表中使用日志选项。我想打印出字符串(summary)的值。我这样做:

 该人的名字是:@ p.name @ 

,但打印内存地址。我可以切换到Debugger Command选项,并执行

  po f.name 
/ pre>

但是我失去了我的描述,如第一个选项中所使用的。使用日志选项,是否有打印字符串值而不是内存地址的方法?

解决方案

有几个你可以做的事情从下拉列表中添加日志功能,然后添加另一个框,然后选择调试器命令并输入 po f.name



如果您希望日志变得更加复杂,您可以这样做:

 该人的名字是:@(const char *)[(NSString *)[p.name description] UTF8String] @ 

最好的方法是使用调试器的图形界面来监视变量。如果要记录消息,请使用 NSLog


I have a breakpoint action and am using the Log option from the drop down. I'd like to print out the string (summary) value. I'm doing this:

the person name is: @p.name@

but that prints the memory address. I can switch to the Debugger Command option and do

po f.name

but then I lose my description, as used in the first option. Using the Log option, is there a way to print the string value and not the memory address?

解决方案

There are a couple of things you can do. Add a Log function from the drop-down, then add another box and select Debugger Command and enter po f.name.

If you want your log to be more complicated, you could do something more like this:

the person name is: @(const char *)[(NSString*)[p.name description] UTF8String]@

You best bet is probably to just use the debugger's graphical interface to watch variables. If you want to log messages, use NSLog.

这篇关于如何从Xcode 4中的断点动作打印字符串值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆