views:

268

answers:

1

I've seen several approaches, and each seem to have significant plusses and minuses. I'm learning iPhone development, I'm building a relatively simple app, which, at it's core, is really not much more than CRUD operations on 3 or four related entities.

I'm used to ActiveRecord-type object persistence. The implementations for Cocoa Touch that I read about online are commonly referred to as extremely slow.

Most of the examples I see online (specifically the Pragmatic Programmers screencasts) have SQL hardcoded into the controller class, which doesn't seem... right to me. Seems very old school (but maybe old school is best in this case).

I know we can't discuss SDK 3.0 here, but it's common knowledge that CoreData is coming for the iPhone, that would of course limit my audience (I'm not sure I really care about that this much. It will be an app for sale, but I'm not planning on it replacing my career)

I have not tried Gus Mueller's FMDB yet, but I have read good things.

What are some of your experiences, what works, and what doesn't. Where would you recommend that a (still pretty novice) iPhone programmer invest their time?

+2  A: 

Right now there's a lot of semi-raw SQL encoded in apps because there's no built-in system for higher level work. FMDB is a nice way to do this but it just wraps the SQLite calls into something more Objective-C like. It's great for some situations but obviously not for everything.

If you're familiar with ActiveRecord then SQLite Persistent Objects may be useful to you, because it's intended to be similar to ActiveRecord. I haven't used either so I couldn't tell you how similar it actually is. If that doesn't seem right for some reason, it's probably best at this point to target 3.0 and make use of Core Data.

Tom Harrington
I'm afraid that the conclusion I am coming to is exactly what you stated. SQLlite Persistent Objects is the one that was quite slow.I believe it's going to be "short term be damned" and target CoreData, since that will be the accepted way as of this summer.I've had trouble adding Core Data to my existing app, but I just went the other way and ported my whole app into the "Window Based application" template using Core Data in just a few minutes. So... it doesn't do anything, but at least it's not crashing, like it did last night.
mmc