热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

检查Xcode调试器中数组的内容-InspectingthecontentsofanarrayintheXcodedebugger

LetssayIcreateanarray:假设我创建了一个数组:NSArray*newArray[NSArrayarrayWithObjects:@foo,@ba

Let's say I create an array:

假设我创建了一个数组:

NSArray *newArray = [NSArray arrayWithObjects:@"foo", @"bar", @"sdfsf", nil];

In Xcode, when I stop at a breakpoint and inspect newArray I see that it says "3 Objects", yet when I click the disclosure triangle all I see is one NSObject and there seems to be no way to see what that array contains.

在Xcode中,当我在断点处停下并检查newArray时,我看到它显示“3个对象”,但当我点击显示三角形时,我看到的只是一个NSObject,似乎无法看到该数组包含的内容。

In practice I am working with an array of custom objects and it is a royal pain to see the nesting or inspect the properties of them.

在实践中,我正在处理一系列自定义对象,看到嵌套或检查它们的属性是一种巨大的痛苦。

Can anyone provide some insight on a better way to use this?

任何人都可以提供一些更好的方法来使用它吗?

2 个解决方案

#1


19  

If it is in scope you can just type

如果它在范围内,您只需输入即可

po newArray 

into the debugger and it will print the description.

进入调试器,它将打印描述。

Or if you prefer clicking things then just right click the object in the left panel pof the console and then click "Print Description of ..."

或者,如果您更喜欢点击内容,则只需右键单击控制台左侧面板中的对象,然后单击“打印描述...”

#2


0  

i'm a fan of NSLog. you should be too :)

我是NSLog的粉丝。你也应该:)

NSLog(@"contents of newArray: %@", newArray);

推荐阅读
author-avatar
手机用户2502923697
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有