O'Reilly logo

Professional Xcode® 3 by James Bucanek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Debugging

WHAT'S IN THIS CHAPTER?

  • Running your application

  • Starting your application under the control of the debugger

  • Setting breakpoints and creating smart breakpoints

  • Examining, changing, and customizing the display of variables

  • Debugging a program running on a remote system

Getting your project to build is sometimes only half the battle. OK, let's be honest; it's often much less than half the battle. It's a cruel fact of programming that your application will have bugs, design flaws, and unexpected behavior. Object-oriented languages, modeling, good design, rigorous coding standards, and unit testing can reduce the number of bugs that creep into your code, but unless your application is trivial, it doesn't matter how careful you've been, how many code reviews you've done, or how many "best practices" you've employed. Someday your application is simply not going to work the way you want it to, and you'll have to find out why. The tool of choice to answer that question is the debugger.

The debugger is a magic window into your application. You can literally watch the internals of your program at work. You can stop your application, examine the values of variables, the state of other threads, and much more. Xcode even allows you to alter values and fix some code while your application is still running — the equivalent of performing a heart transplant on an athlete who's in the middle of running a marathon.

RUNNING YOUR APPLICATION

Before getting into debugging, this section covers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required