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.
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?
As of Xcode 10, you can right-click velocity , choose "View value as..." and then "Custom Type". Then cast it to (double(&)[100]) *velocity and display the array in the GUI. This works!
Click the disclosure triangles to explore instance variables for classes and structures, or internals for other data types. Select a variable and click the Quick Look button to see a preview of the variable, click the Print Description button to print a description of the object in the console.
When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.
Use the po command in the Debug area Set up a breakpoint on the relevant area of code, then when the program stops at the breakpoint, enter commands in the Console in the Debug Area. The relevant command is po (print object) followed by the expression you want to evaluate.
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 ..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With