Chapter 1. Using the Xcode Debugger
In This Chapter
Understanding the kinds of errors that may come up
Using Xcode's Debugger
Zeroing in on errors the Debugger can help you find
Stamping out logic errors with the Debugger
Using the Static Analyzer to analyze your code for memory leaks
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.
Murphy was an optimist about computer programming with his law that there is always one more bug. It took Weinberg's Second Law to put debugging into perspective: If builders built buildings the way that programmers program programs, the first woodpecker to come along would destroy civilization.
As this experienced co-author learned the hard way (indeed, Tony wrote Murphy's Computer Laws in 1980 for Celestial Arts, only to violate most of them in his latest iPhone app project), debugging is not something to put off until later, after the warnings and error messages pile up. Keep in mind Bove's Theorem: The remaining work required to finish a project increases as the deadline approaches. It's best to tackle any errors and warnings you get immediately.
So, what does it take to tackle the inevitable errors that will find their way into your code? In a word, debugging: the process of analyzing your code line by line to view your program's state at a particular stage of execution. To debug a program, you run it under the ...
Get iPhone® Application Development All-In-One 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.