Best database for iOS and Mac?

Discussion in 'iOS Programming' started by JosephDuffy, May 18, 2011.

  1. JosephDuffy macrumors regular

    Jul 12, 2009
    Great Britain
    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
  2. dantastic macrumors 6502a


    Jan 21, 2011
    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!
  3. seepel macrumors 6502


    Dec 22, 2009
    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.

Share This Page