Xcode 4 中的表达式窗口在哪里?
如何在 Xcode 4 中添加要观看的表达式?
这应该是非常明显的,但事实并非如此。它似乎不在任何菜单中,也不能在上下文单击中使用。如果我可以突出显示变量或表达式,然后“添加到监视”或“添加表达式”,那就太好了。
How can I add an expression to watch in Xcode 4?
This should be very obvious, but it is not. It does not seem to be down any menu or available on a contextual click. It would be nice if I could highlight a variable or expression and then "Add to watch" or "Add expression".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不知道有一个选项可以直接从 Xcode 4 的代码窗口创建监视表达式。如果代码窗口中有某些内容您想要添加表达式监视,我认为您必须将该代码复制到剪贴板。
然后在调试时,确保显示调试区域。它是 Xcode 中底部中心视图。您可以通过单击调试视图中相应的视图图标来显示此区域。
然后,在调试区域的左下角,您将看到监视列表。您可以通过右键单击并选择“添加表达式”将表达式添加到此列表:
右键单击添加表达式http://blog.roughfalls.com/non-wp/img/xcode4_addexpression.png
选择此选项后,会出现一个对话框。您可以将复制到剪贴板的表达式粘贴到此对话框中,然后单击“添加”。监视表达式在列表中用左侧的小“E”图标表示。
I don't know that there is an option to create a watch expression directly from Xcode 4's code window. If there's something in the code window you'll want to add an expression watch for, I think you'll have to copy that code to the clipboard.
Then while debugging, make sure the debug area is being shown. It is the bottom center view in Xcode. You can show this area by clicking the appropriate view icon from the debug view.
Then in the lower left of the debug area, you have your watch list. You can add an expression to this list by right-clicking and selecting Add Expression:
Right-click to add an expression http://blog.roughfalls.com/non-wp/img/xcode4_addexpression.png
After you select this option, a dialog appears. You can paste the expression that you copied to the clipboard into this dialog, and click "Add." Watch expressions are denoted in the list with a small "E" icon to their left.
请注意:我遇到了表达式问题,它们没有得到评估(Xcode 4.3.2 调试区域中的表达式未评估)。
为了使其正常工作,我还必须包含表达式的结果类型(例如
(NSString *)[tag name]
)。Just a note: I had a problem with expressions that they didn't get evaluated (Expression in Xcode 4.3.2 Debug area not evaluated).
To make it working, I had to include also the result type of the expression (e.g.
(NSString *)[tag name]
).接受的答案中的图像链接已损坏,因此这里有一个图像来补充它。
右键单击调试区域中的监视列表,然后选择“添加表达式...”
The image link is broken in the accepted answer, so here is an image to supplement it.
Right click the watch list in the debug area and choose "Add Expression..."
对于那些寻求快速使用“添加表达式”的人:
右键单击调试区域中的变量视图。然后选择添加表达式
写入您的 instanceName 或 instanceName.propertyName,然后按 Enter 键。就是这么简单。
For those looking for a Swift usage of Add Expression:
Right click the Variables View in Debug Area. Then choose the Add Expression
Write your instanceName or instanceName.propertyName and press enter. It is that easy.