Xcode 5调试器没有objective-c描述。

时间:2022-10-15 20:41:23

In Xcode 4, when I use the debugger to print an NSArray count, it would show in the console like this:

在Xcode 4中,当我使用调试器打印NSArray计数时,它会在控制台显示如下:

po [self.array count]
3

In Xcode 5, doing this gives me

在Xcode 5中,这样做给了我。

[no Objective-C description available]

This seems to be the case with all numerical types. What is the change or reasoning behind this behavior?

这似乎是所有数值类型的情况。这种行为背后的原因是什么?

2 个解决方案

#1


41  

The command po stands for "Print Object". self.array.count is type NSUInteger which is not an object. Use the p command instead, which is intended to print non object values. E.g.

命令po代表“打印对象”。self.array。count是NSUInteger类型,它不是一个对象。相反,使用p命令来打印非对象值。如。

p self.array.count

The LLDB docs are a great resource.

LLDB文档是一个很好的资源。

#2


2  

In the meantime, I found that if you enclose any numerical type into an NSNumber, it would print out in the console like this:

与此同时,我发现如果将任何数值类型封装到一个NSNumber中,它会像这样在控制台打印出来:

int index = 1;

po index
[no Objective-C description available]
po @(index)
1

po @([self.array count])
3

#1


41  

The command po stands for "Print Object". self.array.count is type NSUInteger which is not an object. Use the p command instead, which is intended to print non object values. E.g.

命令po代表“打印对象”。self.array。count是NSUInteger类型,它不是一个对象。相反,使用p命令来打印非对象值。如。

p self.array.count

The LLDB docs are a great resource.

LLDB文档是一个很好的资源。

#2


2  

In the meantime, I found that if you enclose any numerical type into an NSNumber, it would print out in the console like this:

与此同时,我发现如果将任何数值类型封装到一个NSNumber中,它会像这样在控制台打印出来:

int index = 1;

po index
[no Objective-C description available]
po @(index)
1

po @([self.array count])
3