Find Bugs with Clang Static Analyzer
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):
Installation:
- 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.
Usage:
- 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
Stack Overflow Is Your Friend
June 13, 2009
Joel Spolsky and co. (Stack Overflow) are hosting a new programming conference/tour (LA->London) this October to celebrate their website being totally awesome. They’re planning talks by some smart people on some new(ish) technologies and there’ll be free lunch ($100)! I’m a huge fan of these guys, so I’m confident that it’ll be a good time [at least in LA :].
Stack Overflow DevDays @ Joel on Software
P.S. Dan Grigsby is another smartie and recently posted this Best Of- feature:
Best of Stack Overflow For iPhone Devs @ Mobile Orchard
P.S.S. Don’t miss the “Xcode tips & tricks you wish you knew about!”
iPhone Development Resources
June 5, 2009
Today, I came across a massive collection of iPhone Dev related bookmarks and felt compelled to stop everything I was doing to post it on my blog.
One bookmark I was particularly happy to see was for the open source game engine Cocos2D-iPhone. A few weeks ago, I dived into the framework and found the dev community to be nothing less than extremely welcoming and talented. I’m hoping with a little more knowledge I’ll be able to contribute something rad to such a cool project.
43 iPhone Development Resources @ TheAppleBlog
Seven Essential Xcode Shortcuts for Smarties
May 15, 2009
Part of becoming Xcode proficient is passing my mostly made up 90/10 keyboard-mouse litmus test. Which is to say, “Code with your keyboard and dropkick your mouse to the figurative curb.” Programming is already time consuming as is, so take the shortcuts where you can!
1. Block commenting (Command-/).
2. Show Completion List popup (Escape).
3. Show Symbols popup (Control-2).
4. Switch to Header/Source (Option-Command-Up).
5. Go to next/previous file in File History (Option-Command-Right/Left).
6. Build and Run (Command-Enter).
7. Go to next error/warning (Command-=).
If you’re curious, the full Xcode shortcuts are available for edit under Preferences (Command-,) > Key Bindings and also for download as a PDF at Cocoa Samurai.
Xcode Video Tutorial
May 7, 2009
I’m not terribly in the mood to write tonight, so I’ll keep it brief.
I found this video tutorial on Xcode after another week of hacking away at the MacBook. It’s a quick introduction to the IDE including some handy keyboard shortcuts:
Roadmap to iPhone Development Hell!
April 30, 2009
“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.
Hi, my name’s Ben.
April 23, 2009
I’m a game industry veteran and, today, I’m setting out as an iPhone developer. My plan is to update this blog with stories from the battlefield every Thursday, so let’s see how well that goes. :]