alistairphillips.com

I’m : a web and mobile developer based in the Australia.


Wandering through iPhone Application Development

This past weekend was spent tinkering with iPhone application development which turned out to be fun, interesting and at times darn frustrating. I don't have much of a C background but the little I had done before did help a bit. Objective C itself seems to very nice but things that I take for granted in say PHP (yes I know we can't directly compare this but it's what I use on a daily basis) just don't come across. An example of something that had me stumped was this:

NSUInteger row = [indexPath row];
NSArray *myData = [NSArray alloc];
myData = [dataObject.getContents];
NSDictionary *singleResult = [NSDictionary alloc];
singleResult = [myData objectAtIndex:row];
// further processing using singleResult
[singleResult release];

I'd had some code very similar to this to update a UITableView and then in didSelectRowAtIndexPath I was trying to retrieve the selected data. But that was crashing things. Being silly I assumed that singleResult now contained a copy of the data, not just a reference to it. And when I'd released it before it deleted it completely so when trying to grab it again it was gone. Thanks to Bryn for pointing that one out.

After some fiddling I've now got a UITabBar project going with the second tab having a UINavigationController populating itself from a SQLite database. Once you've fiddle around, gotten lost and then found your path again things start to make sense. I'm only scratching the surface of things but I do feel a bit more confident - lots to do before I can come up with anything extremely useful!

I'd definitely recommend Beginning iPhone Development: Exploring the iPhone SDK from Apress. Lots of hand-holding and wity humour to get you started, and hoping that there will be an addition to this book perhaps going into a few more details on other topics.