PDA

View Full Version : Best database for iOS and Mac?




JosephDuffy
May 18, 2011, 01:57 PM
Hi,
I'm coming to the point where I should be creating a functional iOS App soon.
It's going to be based around a large database with a lot of entries.
I'm wondering, what's the best format for speed, ease of use (When adding data to) and compatibility (I might make a Mac version if the iOS version is a success).
I'm currently using a plist file, but I think SQLite can be used, and something else I believe.
So, what's your opinion, what would you go for?
Thanks for any feedback,
Joseph Duffy



dantastic
May 18, 2011, 02:26 PM
On the iPhone the choice is between SQLite and Core Data - Core Data is in many ways a wrapper for SQLite doing a lot of the heavy lifting for you. Core Data is available on the Mac as well. CD is really nice, I recommend using it!

seepel
May 21, 2011, 01:33 PM
On the iPhone the choice is between SQLite and Core Data - Core Data is in many ways a wrapper for SQLite doing a lot of the heavy lifting for you. Core Data is available on the Mac as well. CD is really nice, I recommend using it!

This is absolutely true, and I highly recomend Core Data as well. I'll expand a bit by saying that in my experince the difference between Core Data and SQLite is that Core Data is very object oriented. But as far as iOS integration, Core Data is a lot cleaner and easier to implement.

Example 1: Let's say you want to select a number of records and delete them, with SQLite you can do this in one fell swoop. In Core Data you'll have to loop over the objects individually which will make things slower.

Example 2: Let's say you want to display a series of records in a table view. In SQLite you'll have a lot of boilerplate code to write to do this. In iOS you can simply use the NSFetchedResultsController and you get a lot of nice features and a working table view on the order of a few hours or less.

So if your database will be really large, you may want to use SQLite, but I would think twice before choosing that route, as it is certainly the path of greatest resistance.