Chapter 15. Debug and Deploy

Get in, get out. That's the attitude that most developers have in testing and debugging their applications. Few developers look forward to these tasks during the development cycle; they want to efficiently get into the code, figure out what's working and what's not, fix any problems, and then move on.

Given the heterogeneous nature of Web applications, debugging has always been challenging, particularly when trying to work with client-side JavaScript. To address this need, fairly sophisticated debugging tools have emerged over the past few years among the developer community, most notably Firebug and other add-ons to Firefox. However, the problem is that most of these testing tools that Web developers have come to rely on for desktop browsers are not ideal for testing iPhone Web apps.

Many iPhone Web app developers, unsure of where else to turn, are tempted to resort to alert() debugging — you know, adding alert() throughout the body of the script code to determine programmatic flow and variable values. However, not only is this type of debugging painful, it can throw off the timing of your script, making it difficult or impossible to simulate real-world results. Although the number of debugging and testing tools is indeed limited right now for Safari on iPhone, you still have options that either work directly inside Safari or emulate it on your desktop. You will probably want to incorporate aspects of both as part of your regular debugging and testing ...

Get Safari® and WebKit Development for iPhone® OS 3.0 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.