iPhone SDK Development

Sean Maher — Dec 08, 2009

Examples for every iPhone feature

‘iPhone SDK Development’ by Bill Dudney and Chris Adamson is one of the ‘third wave’ of iPhone programming books, and an excellent tour of Cocoa Touch and Xcode — the libraries and IDE for iPhone programming.

Audience

The book assumes that you have some experience with C and/or an object-oriented language. You’re expected to know what pointers and arrays are, and the control structures (for loops, if and switch statements) that are common to most curly-brace languages. This is the Achilles heel of most iPhone and Cocoa books — they assume you have a C or OOP background. In this case the litmus test is page 27 — read that one in the bookstore, and if it makes no sense, put the book back.

Topics

‘iPhone SDK Development’ begins with Hello World, of course, and the default iPhone app template. Many parts of the default template are created automatically, so it’s great to have its innards dissected and labeled. This is follow by an exploration of views, tables, and controllers. The examples were created with the latest (3.x) version of the iPhone SDK, so you can be assured that the sample code works without needing modification.

Far from being just a recipe book, each example comes with an explanation of how the code works. The authors deftly detail topics that confuse new iPhone programmers, like memory management and properties; they also provide working code for problems that have puzzled iPhone message boards in the past, like creating custom table cells from a .nib file.

‘iPhone SDK Development’ is not aimed primarily at game developers — the only game related sample code is a multi-player tapping game in the P2P networking chapter — but it does include overviews and code samples for the technologies that game programmers will be interested in such as audio sessions, Animation, the accelerometer, GPS, and the compass. There are also four pages sketching out a skeleton for OpenGL before directing you to the OpenGL SuperBible for more information.

The chapters on data storage cover the whole gamut of options — flat files, plists, straight SQLite, and core data. The networking chapters begin by creating a simple web browser before diving into HTTPS, XML parsing, and peer-to-peer networking with Bonjour and Game Kit.

From there the authors cover multimedia topics including video playback, access to the iPod library and multiple methods of audio playback and recording, multi-touch controls, the camera, the address book, and the Map Kit.

The last three chapters — on debugging, performance tuning, and the ins and outs of publishing on the app store — round out the book nicely.

Organization and Layout

The long-term value of a technical books hinges on its index, and the index is strong with this one. If doesn’t include every keyword used in the program listings, but it is otherwise comprehensive and useful. This fits with the structure of the book which is a series of examples, not a reference guide or a rehash of Apple’s docs.

Every program listing begins with a gray bar at the top telling you which file the code belongs in — a nice touch that renders multi-file examples more understandable. The use of boldface in the program listings was inconsistent though, and distracting until I learned to ignore it. The rest of the layout was clear and unobtrusive, with many screen shots for Interface Builder operations in particular.

Conclusion

The authors clearly know their stuff, and no technical flaws were evident. They could have accurately added advanced to the title — this is not a book for novice coders, and contains a lot of information that was missing from Apple’s docs and only available in message boards. It’s also one of the most up-to-date iPhone books I’ve read, with information on the 3GS device and the new static analyzer.

For anyone who’s done some Mac OS X or iPhone programming before, or with experience in another object-oriented language, the book is a perfect fit with lots of example code for every iPhone feature.

Chapter Listing

  1. Introduction
  2. Hello iPhone
  3. iPhone Development Fundamentals
  4. View Controllers
  5. Table Views excerpt
  6. Navigation
  7. Tab Bar Controllers
  8. File I/O
  9. Preferences
  10. The SQLite Database
  11. Core Data excerpt
  12. Connecting to the Internet
  13. Peer-to-peer Networking excerpt
  14. Video Playback
  15. iPod Library Access
  16. Playing and Recording Audio
  17. Core Audio
  18. Events, Multi Touch and Gestures
  19. Drawing in Custom Views
  20. Drawing Images and Photos
  21. Core Animation
  22. Accelerometer
  23. Address Book
  24. iPhone Location API
  25. Map Kit excerpt
  26. Application Integration
  27. Debugging
  28. Performance Tuning
  29. Before and After