I’ve been doing iPhone development for the last 5 months or so, and have been using Gus Mueller’s FMDB for database interaction. My next project will have both a Mac and an iPhone application, and they will share data between them, although in the end, the iPhone will be mostly a viewer app, with some minor editing capabilities.
My question is this: Will Core Data make my life easy enough on the Mac side, that it would be worth it to write my data model twice, using Core Data on the Mac, and FMDB on the iPhone? Or should I just use FMDB for both so that I can reuse the same code for both the Mac and iPhone?
I’ve poked at Core Data a little, but not much (mostly just the examples in the Hillegas book), so any specific examples in favor of Core Data would be greatly appreciated. For the record, I really like FMDB, I’m just wondering if Core Data would make my life that much easier in this situation.
Edit: I understand the core differences between FMDB and Core Data, I’m mostly looking to find out if what Core Data provides ‘for free’ makes it worth coding my data model twice.
The main difference is that FMDB is an Obj-C wrapper for SQLite, whereas CoreData is an object model that happens to store data in SQLite (you’re not editing a database but instead editing objects). This means that it’s a bit higher level and provides more abstraction, but if you know what you’re doing with databases then you should be fine with either. Personally I’d err on the side of sharing code as it results in less bugs, easier development and faster releases.