July 31, 2009
So in my absence I wrapped my first iPhone app. I sent off a build for review last Monday and I’m hoping to hear back from Apple sometime this or next week.
Today, I thought I’d share about a really neat debugging tool called Clang Static Analyzer. Basically, this tool runs through your code and points out potential bugs (memory leaks, logic errors, etc.). It’s powerful and easy to use, so I’d totally recommend adding it into your pipeline.
These were the steps that worked for me (repost from here):
- Download the latest build from: http://clang-analyzer.llvm.org/
- Extract and move the contents of the archive to a directory of your choice.
(I use “/Developer/clang/”)
- Launch Terminal and input this command: sudo nano /etc/paths
- Add Clang as a system path by entering the directory location.
- Press ‘Ctrl-X’ to exit and then ‘Y’ to save.
- Launch Xcode, open your project, and run “Build > Clean All Targets.”
- Launch Terminal, navigate to your project directory, and input this command:
scan-build -k -v -V xcodebuild -configuration Debug -sdk iphonesimulator###
(Substituting “###” with your target OS. e.g. “2.2”)
Assuming everything works, Safari should then open a report highlighting the possible bugs in your project!
For a video demonstration, see Stanford’s CS193P Lecture 11 from May 6, 2009 (05:00-17:47).
And here’s a preview of my app: iFist