Chapter 8. Using the Debugger

In This Chapter

  • Knowing how things can go wrong

  • Using Xcode's Debugger

  • Finding and fixing logic errors with the Debugger

Now that things have gotten a little more interesting, so will the errors.

Let's face it. There are always going to be errors. No matter how good you are, how much experience you have, how careful you are, or even how smart you are, they are a programming fact of life.

You'll come up against three kinds of errors. Each one has a unique personality and associated techniques for finding and correcting. Here is a list of the three types you'll come up against:

  • Syntax errors

  • Runtime errors

  • Logic errors

The last two types, runtime and logic errors, are what are commonly referred to as "bugs."

Identifying the Usual Suspects

Note

While there is no exercise for this chapter, you can follow along with me if you like by using the project in the Chapter 8 Start Here folder in the Chapter 8 folder on the CD. Or you can use the project you use at the end of Chapter 7.

Catching syntax errors

As I mentioned earlier in this book, compilers take your source code and turn it into something the computer understands. For that process to go smoothly, the source code you give the compiler has to be something it understands. All of the operations and framework functionality I cover in Chapter 4 and continue to cover have to be coded in a certain way, and the compiler expects that you follow those rules (syntax). When you don't, it gets visibly annoyed. So when you type ...

Get Objective-C® 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.