如何在Xcode中添加Watch或Inspect?

时间:2022-04-09 08:03:31

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]的结果,实际上是踩到或踩到。

2 个解决方案

#1


14  

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([返回类型])[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?

#2


16  

To actually see the value change while you step through, you can right click the watch list of the debug area and choose "Add Expression..."

要在单步执行时实际查看值更改,可以右键单击调试区域的监视列表,然后选择“添加表达式...”

如何在Xcode中添加Watch或Inspect?

#1


14  

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([返回类型])[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?

#2


16  

To actually see the value change while you step through, you can right click the watch list of the debug area and choose "Add Expression..."

要在单步执行时实际查看值更改,可以右键单击调试区域的监视列表,然后选择“添加表达式...”

如何在Xcode中添加Watch或Inspect?