August 28, 2010
Getting into Objective C for iPhone

Recently, I’ve started programming a bit of Objective C for iPhone. Historically, I’m an HTML, PHP and Actionscript kinda guy, so moving into a lower level, C-based language has been a bit of a challenge.

Other than the differences in syntax, one of the main hills Actionscript and web developers have to face is memory management. Although automatic garbage collection is used for some objects, anything you want to keep in memory you’ll have to manually get rid of later. It’s not as bad as it first looks though, and running the app with Leaks module of Instruments is a key to spotting errors here. In fact, it’s so easy to forget to release variables of forget to autorelease returns from functions that doing this regularly during build is invaluable. Don’t wait until the end of development to fix your memory leaks.

Another interesting thing you’ll have to eventually contend with is possibly the least helpful error message in the world: “Confused by earlier errors. Bailing out.” This can be easily got rid of when it appears alongside the said “earlier errors”. However it will occasionally appear on its own and can take a bit of detective work to fix. This is where you need to get the breakpoints and the debugger working for you!

When you’ve got used to the basics and the workflow in Xcode, you’ll find Interface Builder easy to pick up and have basic, working apps in no time.

It’s a satisfying language to program in. Quite verbose, but if you like object oriented programming and enjoy the level of detail required you’ll be fine.

Oh, then you’ll have to deal with code-signing and certficates to get your app on devices. This is a bit of a art but, usually, following the instructions on the Apple Dev site does the trick. Ironically, the process to upload the thing to the App store is involved but fairly painless. As long as it gets accepted in good time! Apple publish an estimate of review wait times in their developers portal, so while not a guarantee, you’ll at least get an idea on how long it will take for them to pass verdict.

I’ll try and post something more than just general ramble soon - especially when I start making proper apps!


Blog comments powered by Disqus