Chapter 8. Debugging iPhone web pages

 

This chapter covers

  • Installing a local server to aid debugging
  • Using a variety of browsers and add-ons
  • Profiling iPhone code

Now that you’ve learned how to code iPhone web pages in a variety of ways, you’re probably ready to dive right in. But as we discussed in the last chapter, programming great iPhone web pages isn’t just about using the right libraries, it’s about using the right tools as well. In chapter 7, we discussed a specific tool, the Dashcode development platform. Now we’re going to look at some more general tools that can be used to test and debug a variety of programs. We’ll begin with the most fundamental tool of all: the Apache web server.

8.1. Using Apache locally

If you have a Mac OS X computer, you can take advantage of its built-in Apache web server to quickly prototype and test web pages. Setting it up is a simple process, as outlined in table 8.1.

Table 8.1. Setting up your local Macintosh to preview web pages is quick and simple.

Step

Description

1. Start up your web server.

From the Apple menu, choose System Preferences.

Click the Sharing icon.

Select the Web Sharing checkbox.

2. Share files.

Create files with a plain text editor, such as Emacs, which can be accessed from the Terminal.

Move the files to the Sites folder in your directory.

3. Test.

Visit your web pages from your Mac at http://127.0.0.1/~YourUsername/Test, test, test.

8.2. Debugging with your desktop browser

8.3. Debugging with your iPhone

8.4. Profiling for the iPhone

8.5. Summary

sitemap