如何从Xcode 4中的断点动作打印字符串值? [英] How to print string value from breakpoint action in Xcode 4?
问题描述
该人的名字是:@ 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 enterpo 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屋!