Xcode 有监视窗口吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6500718/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:21:40  来源:igfitidea点击:

Does Xcode have a watch window?

xcodedebuggingglobal-variables

提问by Chris Masterton

Does Xcode have a watch window for variables? It has a window for local variables but that's not much help when I want to watch the value of a global.

Xcode 是否有变量监视窗口?它有一个局部变量的窗口,但是当我想查看全局变量的值时,这没有多大帮助。

I've been spoiled by VisualStudio, I know.

我知道我被 VisualStudio 宠坏了。

回答by Chris Masterton

Solved! Right-clicking in the local variables window brings a menu option of "Add Expression". Type your variable name and now you are watching your variable/expression.

解决了!在局部变量窗口中右键单击会出现“添加表达式”菜单选项。输入您的变量名称,现在您正在观察您的变量/表达式。

The language of "expression" instead of the more familiar "variable" threw me quite a bit. Hard to search for a solution when I have the terminology wrong. Seems obvious now.

“表达”的语言而不是更熟悉的“变量”让我很不舒服。当我的术语有误时,很难找到解决方案。现在似乎很明显。

回答by yoAlex5

Open Debug Area via View -> Debug Area -> Activate Console(Xcode 9)

通过View -> Debug Area -> Activate Console(Xcode 9)打开调试区

Right click -> Add Expression

Right click -> Add Expression