Chapter 10. Using the Debugger

In This Chapter

  • Seeing the kinds of errors that may come up

  • Using Xcode's Debugger

  • Zeroing in on the kinds of errors the Debugger can help you find

  • Stamping out logic errors with the Debugger

Let's face it: When you're developing an application, sometimes things don't work out quite the way you planned — especially when you knock over a can of Jolt Cola on the keyboard and fry it out of existence.

"Stuff happens," in the immortal words of a famous ex-U.S. Secretary of Defense. When it comes to developing your own programs, that "stuff" comes in three categories:

  • Syntax errors: Compilers — the Objective-C compiler in Xcode is a case in point — expect you to use a certain set of instructions in your code; those instructions make up the language it understands. When you type in If instead of if, or the subtler [view release} instead of [view release], the compiler suddenly has no idea what you're talking about and generates a syntax error.

    Syntax errors are the most obvious of errors out there, simply because your program won't compile (be able to run) until all of these are fixed. Generally, syntax errors spring from typographical errors like those mentioned here. (And yes, the errors can by pretty penny-ante stuff — an I for an i, for goodness sake — but it doesn't take much to stump a compiler.)

    In Figure 10-1, you can see an example of a syntax error. This one was kindly pointed out to me by Xcode's friendly little Debugger feature (more on him later). I'd ...

Get iPhone™ Application Development for Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.