Monthly Archives: March 2009

Static Code Analysis for iPhone Apps

Starting with Habits 1.1, I started incorporating static analysis into my build. In my previous experience with things like Lint and FXCop — I had found the signal to noise ratio to be too low to be useful. It’s hard to believe, but scan-build is 100% signal — every single issue it flagged was legitimate and needed to be fixed. Now, keeping Habits free from issues is easy, since I only have to deal with one or two at a time.

There were a couple of times I thought it was leading me in the wrong direction, but it was right so often that I just trusted it, and it was right about those too. I had a particularly interesting case with a custom table cell, where I wasn’t releasing properly, and causing a crash when I dealloced the window. Scan-build helped me make sure I found that before release.