Prior to the release of OS 3.0 on the iPhone, SQLite was the choice for database implementation on the iPhone. Since the addition of core data to the iPhone SDK, using SQLite with low level C function calls is no longer the only option, and now a question often asked is about which to use.
First, let’s take a look at using SQLite directly.
– Relational Database System
– Potential for cross platform compatibility
– Many early iPhone database examples were written using SQLite
– Objective-C wrappers such as FMDB are pretty easy to use
Now at Core Data:
– Can store data in it’s own Binary, or SQLite storage format.
– Can serialize objects
– Much higher level than using SQLite directly
– Not a RDBMS you could actually just store things directly.
Now the real question is, which is easier to use? Well, that really depends on what you’re doing. In an app I recently created all I had to do was read small amounts of data sequentially from a SQLite database, since this is such a simple task I simply used FMDB along with iPhone SQLite. Now, if I needed to do anything with the data beyond reading it, Core Data can make all this much easier, and I’d recommend using it.
Conclusion: Core Data just makes so many things so much easier that I would recommend using it unless you already have existing code, or are doing only the most basic database usage.