简体   繁体   English

在Xcode中进行调试时,如何查看值?

[英]How do you see values when debugging in Xcode?

I'm trying to see what the value of myImage.height is in the debug mode in Xcode, I've got a breakpoint on this line... 我正在尝试查看XImage在调试模式下myImage.height的值是什么,我在这行上有一个断点...

float s=myImage.height/cos(30*M_PI/180)/2;

It all runs fine and get's to that line, in the debug panel I can see myImage (my Image is a Sparrow framework SPImage object) but I can't see any values for any of the class vars. 一切运行正常,到达那一行,在调试面板中,我可以看到myImage(我的图像是Sparrow框架SPImage对象),但是看不到任何类var的任何值。

This is literally the first time I've used a break point/debug panel in xcode so I'm probably just not doing something right. 从字面上看,这是我第一次在xcode中使用断点/调试面板,所以我可能只是做的不正确。

I also tried 我也试过

NSLog(@"myImage height: %f",myImage.height);

But I can't see that being outputted in the output panel either. 但是我也看不到它在输出面板中输出。

I'm coming from a AS3 background, where you would see... 我来自AS3背景,在那里您会看到...

myImage.height along with it's value to the right in the debug panel in Flash, so I'm looking for the same thing in Xcode. myImage.height及其值在Flash的调试面板中位于右侧,因此我正在Xcode中寻找相同的内容。 Do I have to run it in a different mode or is there another panel to open or something? 我是否必须在其他模式下运行它,或者是否需要打开另一个面板?

In the console area, you can show 2 distinct "parts", one is the variables in scope, and the other is the actual output console. 在控制台区域中,您可以显示2个不同的“部分”,一个是作用域中的变量,另一个是实际的输出控制台。 In the stack area, you can see all variables in scope. 在堆栈区域中,您可以看到作用域中的所有变量。

You can also hover your mouse over any variable in code , then click on the little disclosuer arrow and select "print description" to have it plop it into the console. 您也可以将鼠标悬停在代码中的任何变量 ,然后单击发行者的小箭头,然后选择“打印说明”以将其放入控制台。 (The console is also where NSLog stuff goes). (控制台也是NSLog的去向)。

Check out this picture: 查看这张图片:

Xcode调试

And then this one: 然后这个: 在此处输入图片说明

Note you can also "print description" from the variable area: 请注意,您还可以从可变区域“打印说明”:

从变量区域打印说明

edit here's more detail on the hover-access to the value: Click on the variable name, then move the mouse to the right, and there should pop up a yellow bar with info about the instance. 编辑以下有关对值的悬停访问的更多详细信息:单击变量名,然后将鼠标移到右侧,然后会弹出带有有关实例信息的黄色栏。 This is is different from the little blue arrow, which is available even when not debugging. 这与蓝色的小箭头不同,蓝色的小箭头即使未调试也可用。

悬停访问运行时值在此处输入图片说明

If anything is being outputted, it's in the bottom panel. 如果有任何输出,则在底部面板中。 There are three icons on the top right of the bottom panel, and each one shows different data views. 底部面板右上方有三个图标,每个图标显示不同的数据视图。 Try all three. 尝试全部三个。 In case you can't see the bottom panel, you can show it with the middle button in the segmented control above the word "View" in the top right of your XCode window. 如果看不到底部面板,可以使用XCode窗口右上角“视图”一词上方的分段控件中的中间按钮来显示它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM