Breakpoints, and Actions, and Code...Oh My!

Using a breakpoint is a way to stop code execution at a place you choose, or when any problems occur. All you do is click in the line number next to a piece of code, and Xcode inserts a breakpoint. Figure 14-9 showed one in blue on line 80.

When running code (on both the simulator and real devices) hits a breakpoint, Xcode stops execution and enters the debugger. You can examine the call stack, look at variables, step over code, or even step into other methods. The variable window shows you values and even lets you change a BOOL from YES to NO.

Most people try to find issues by inserting an NSLog statement where they think the issue is, running the code, getting closer, putting in different NSLogs, ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with O’Reilly online learning.

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