17

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

po [self.array count]
3

In Xcode 5, doing this gives me

[no Objective-C description available]

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

1
  • 7
    Tried p instead of po?
    – Zen
    Sep 27, 2013 at 17:50

2 Answers 2

40

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.

p self.array.count

The LLDB docs are a great resource.

3
  • 1
    Interesting, yes that would make sense :D. Didn't know there was a "p" command. Thanks for the response and link. Sep 27, 2013 at 18:28
  • 3
    Never even knew about 'p'
    – GoldenJoe
    Sep 27, 2013 at 21:24
  • 1
    The interesting point is that "po" has worked since at least Xcode 3 and through all versions of Xcode 4. But it stopped working in Xcode 5. I agree with @matjan.
    – Tim T
    Dec 23, 2013 at 0:09
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:

int index = 1;

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

po @([self.array count])
3
1
  • Nope... error: illegal type 'NSInteger' (aka 'int') used in a boxed expression
    – Matjan
    Dec 1, 2013 at 5:03

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.