Best Of Stack Overflow For iPhone Devs

On May 6, 2009

Stack Overflow is a remarkable site. Billed as a “collaboratively edited question and answer site for programmers” it manages, through a clever hybrid of wiki-style collaborative writing and a reputation system, to be actually helpful.

Stack Overflow has a treasure trove of iPhone, Objective-C and Xcode related material. It’s a great place to pick up good software engineering practices, programming and dev-environment tips, and to avoid the common (and un-common) pitfalls that lie waiting for us.

To highlight some of the best of Stack Overflow as it relates to iPhone development I’m starting a new periodic “Best of Stack Overflow For iPhone Devs” feature. Enjoy:

What are best practices that you use when writing Objective-C and Cocoa? — A case for putting dealloc at the top of a .m class, performance gains of opaque (vs. transparent) cells, performance gains for non-atomic properties, memory semantics for IBOutlets, and more!

Tips for a successful AppStore submission? — An always popular topic here, the Stack Overflow thread includes speculation about Apple checking-or-not-checking for memory leaks, tips to ease the complexity around code-signing, bundle identifiers and version numbers, and more.

Formatting a (large) number “12345” to “12,345” — A great real answer (use NSNumberFormatter — I had’t run across this before) and one laughable one to boot.

What are those little Xcode tips & tricks you wish you knew about 2 years ago? — Lots of goodies to make you proficient, and efficient, in Xcode. Examples: using ctrl-/ to jump to the next argument in Code Sense completion; using the pre-processor on your Info.plist file.

Checking For Internet Connectivity in Objective C — Answer: Apple’s Reachability sample code demonstrates how “to use the System Configuration framework to determine the network state of an iPhone or iPod touch. In particular, it demonstrates how to know when IP traffic might be routed through a carrier data network interface (such as EDGE).”

Programmatically get own phone number in iPhone OS — ‘Nuff said.

Cocoa Bad Habits — Passing nil to arguments that call for NSError**, lazy use of accessors within a class, exceptions as flow control, and more. When used as a what-not-to-do list it’s a surprisingly good way to notch up the quality of your code.

Can I embed a custom font in an iPhone application? — Very cool: an answer pointing to a github hosted project module that extends UILabel to support including your own .ttf fonts.

Understanding reference counting with Cocoa / Objective C — When I’m trying to wrap my head around some hard-to-grok concept, I find it helpful to have a bunch of people try to explain it to me independently. The subtle variations in their approaches help me glue the concepts down. This question features 14 different answers to piece together your own understanding.

Why do Programmers Love/Hate Objective-C? — How did this not turn into a flame war?

0 responses to “Best Of Stack Overflow For iPhone Devs”

  1. Peter Ickle says:

    Great collection. Stack Overflow can be useful but just like any site on the inter-webs you have to take it with a grain of salt; there are a lot of ill informed people on that site.

  2. Brad Larson says:

    Peter, the nice thing about Stack Overflow is that wrong answers tend to get downvoted very quickly. Oddly enough, almost all of the answers are helpful (some of the questions, though, could be answered with a 5-minute Google search).

    The reputation system is a brilliant idea, where it becomes like a game to see how many people you can help with difficult problems. I know I’ve found myself researching new topics in Core Animation just so I could fix someone’s obscure problem.

  3. Nosreda says:

    Haha. My “laughable” solution was brilliant. Can’t you people think outside of the box? 🙂