How to Use the Debugger to Test Your iOS App Code

Here is something interesting to look at in the Debugger for your iOS app. As it stands, you can compile your app with no errors and it runs, albeit the same way that it did before. So you have no idea if all that code you added really works. Does it really find the Destination.plist file and create all the dictionaries with their entries correctly?

One way to find out is to put a breakpoint in your code and see what’s there by clicking in the gutter next to (in front of) the line:

If your program execution stops at a breakpoint, you can move your pointer over an object or variable in the Source editor to see its contents.

destinationData is a pointer to the dictionary that contains the data for the first entry in the Destination plist’s DestinationData array. You’ll have six key/value pairs, as you should have, and if you look in the Variables pane in the Debugger, you’ll see two objects in the DestinationsArray, which is also as it should be.

You can explore the display by opening the disclosure triangles to drill down and look at the data.

You can use the circled i to reveal the contents of the variable.

Finally, you can use the Quick Look icon to explore the variable and its memory location.

For Dummies: The Podcast

Check out the brand new podcast series that makes learning easy with host Eric Martsolf.