如何在 Xcode 中添加 Watch 或 Inspect? [英] How do I add a Watch or Inspect in Xcode?

查看:44
本文介绍了如何在 Xcode 中添加 Watch 或 Inspect?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如标题所示,Xcode 中有没有办法在 Xcode 中添加监视或检查代码段

as in the title is there a way in Xcode to Add Watch or Inspect a code segment in Xcode

例如,我怎样才能看到 [myObject aMethod] 实际跨过或跨入的结果.

for example how can I see the result of [myObject aMethod] with actually stepping over or Stepping in.

推荐答案

在调试器控制台中,如果在断点处停止,可以键入 po [myObject aMethod] 以查看返回值(如果它不是 id 类型的返回值,使用 p ([return type here])[myObject aMethod]).

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]).

还可以设置断点动作,不暂停打印出来,直接右键编辑断点:

You can also set a breakpoint action to print something out without pausing, just right click to edit the breakpoint:

这篇关于如何在 Xcode 中添加 Watch 或 Inspect?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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