Using the Xcode Debugger

You can use the debugger to do the following:

bullet_2c.tif Pause your app at any line of code.

bullet_2c.tif Pause your app if a condition is true.

bullet_2c.tif Step through code line by line.

bullet_2c.tif Skip over methods and functions.

bullet_2c.tif While the app is paused, view variables, objects, and memory.

The debugger is built into Xcode. You don’t need to modify your code to use it. But you do need to set one or more breakpoints, or pause locations.


Breakpoints have many powerful options. You can set them to play a sound, run an external script, or generate a log message—among other options. Most of these options are specialized, and you don’t need them for basic debugging. But it’s useful to know that they’re available.

Breakpoints can be unconditional or conditional. Xcode always pauses at an unconditional breakpoint, but pauses at a conditional breakpoint only if a condition you specify is true. For example, ...

Get iOS App Development Portable Genius now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.