Inspecting the contents of an array in the Xcode debugger
11,668
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 ..."
Author by
Hippocrates
Updated on June 23, 2022Comments
-
Hippocrates about 2 years
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 oneNSObject
and there seems to be no way to see what that array contains.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?
-
jscs about 12 yearsEven better,
po [myArray objectAtIndex:10]
will also work, as willpo [[myArray objectAtIndex:10] someProperty]
. -
Ryan Heitner about 9 yearsor po [myArray[10] someProperty]