如何在 Xcode 中添加 Watch 或 Inspect?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7145034/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I add a Watch or Inspect in Xcode?
提问by Java Ka Baby
as in the title is there a way in Xcode to Add Watch or Inspect a code segment in Xcode
如标题所示,Xcode 中有没有办法在 Xcode 中添加监视或检查代码段
for example how can I see the result of [myObject aMethod] with actually stepping over or Stepping in.
例如,我如何才能看到 [myObject aMethod] 实际跨过或跨入的结果。
回答by Suragch
回答by jtbandes
In the debugger console, if you stop at a breakpoint you can type po [myObject aMethod]
to see the return value (if it's not an id
type return value, use p ([return type here])[myObject aMethod]
).
在调试器控制台中,如果在断点处停止,则可以键入po [myObject aMethod]
以查看返回值(如果它不是id
类型返回值,请使用p ([return type here])[myObject aMethod]
)。
You can also set a breakpoint action to print something out without pausing, just right click to edit the breakpoint:
您还可以设置断点操作以在不暂停的情况下打印一些内容,只需右键单击即可编辑断点: