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):

Installation:

  1. Download the latest build from: http://clang-analyzer.llvm.org/
  2. Extract and move the contents of the archive to a directory of your choice.
    (I use “/Developer/clang/”)
  3. Launch Terminal and input this command: sudo nano /etc/paths
  4. Add Clang as a system path by entering the directory location.
  5. Press ‘Ctrl-X’ to exit and then ‘Y’ to save.

Usage:

  1. Launch Xcode, open your project, and run “Build > Clean All Targets.”
  2. 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

“I’ve made a terrible mistake!”

..is what I might say if I was prone to giving up and afraid of challenges. In reality, I’ve found learning about iPhone development to be quite exciting, if sometimes painful. Being a PC enthusiast for the past decade, it was an interesting experience trading Windows for OS X and Visual Studios for Xcode. From shortcuts to the file explorer, I can only summarize my feelings as, “you’ll rewrite your expectations.”

Yet, the PC to Mac transition is only one step towards being an iPhone Developer. I’ve spent time in the iPhone Dev Center watching the appropriately named “Getting Started Videos,” been bored, stopped, and turned to learning Objective-C, practically headbutting (read: head to keyboard) a sample app onto my iPhone* and, most recently, stumbled across the excellent Stanford U’s iPhone Application Programming podcasts via iTunes.

In the short time I’ve spent entrenched in iPhone development, I’ll recommend three things:

1. Read CocoaDevCentral’s Learn Objective-C primer,

2. Watch Pragmatic Programmers’ free Getting Started with Xcode and Interface Builder screencast,

3. Subscribe to Stanford U’s CS193P iPhone Application Programming webcasts and unofficial iPhone Application Development Auditor‘s Google Group.

‘Til next week!

* – I’m saving this.