Where is the expression window in Xcode 4?

让人想犯罪 __ 提交于 2019-11-27 10:27:25

问题


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".


回答1:


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.




回答2:


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




回答3:


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..."




回答4:


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.



来源:https://stackoverflow.com/questions/5632477/where-is-the-expression-window-in-xcode-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!