Writing Bug-Free Code
Although some developers think that writing code is where they spend the vast majority of their time when they’re developing an app, debugging is actually right up there as a very close second. (And yes, I know that the title of this section is wishful thinking.)
Because debugging plays such a crucial role in writing workable code, I want to use this section to emphasize two points:
App developers should strive to write code with as few bugs as possible (duh!).
App developers need to know how to use the debugger so they can track down the inevitable bugs they do introduce into their code as efficiently as possible.
With the release of Xcode 4, Apple has made it easier to write code with fewer bugs, as well as use the debugger to track down bugs you do have.
Because the best defense is a good offense, I want to start with the tools that Xcode provides that help you to write less buggy code. Xcode has figured out that the best way to make sure your code has as few bugs as possible is by giving you the opportunity to fix the code as you write it. Such opportunities come in the form of Xcode’s various compiler warnings. More specifically, by taking advantage of the Live Issues and Fix-it features, which I explain in Chapter 7, you’ll catch many of your errors before ...
Get iPad Application Development For Dummies, 3rd Edition 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.