2

I am writing a trivia app in which there will be hundreds of sets of questions.

The app will come pre loaded with some quizzes however they would then need to download further quizzes which once downloaded will be stored within the app so that users can play them offline.

In this specific instance would I be better using core data or SQLite.

Thanks in advance.

  • Did you do even a basic Google search on this before expecting others to spend time assisting you? Have a look at https://maniacdev.com/2009/09/iphone-sqlite-vs-core-data-–-which-to-choose http://www.drdobbs.com/mobile/ios-data-storage-core-data-vs-sqlite/240168843 http://stackoverflow.com/questions/523482/core-data-vs-sqlite-3 – Max MacLeod Jun 17 '15 at 13:17
  • Yes I did a basic google search. What it told me was that both have pro's and con's. What I am not sure of as a new programmer is which of these pros/cons I should take most notice of in this specific instance. Hence why I was asking for some advice. – Alan Burnell Jun 17 '15 at 13:34

1 Answers1

2

The thing you have to realise here is that CoreData is not a DataBase.

It is an object persistence layer in your app. It happens to be backed by a SQLite DB by default but that's largely irrelevant.

I have written apps with a CoreData store that contains in the region of 100,000 entities and millions of relationships between them.

The argument that CoreData cannot handle complex data is not correct.

The trick is to design your Object Model exactly like you would define you object model in code.

You don't need foreign keys or join tables (these are all handled for you by Core Data).

If you have (for instance) a many-to-many relationship between Class and Student then just create a relationship between them and define it as a Many relationship on each end. Core Data will handle the data for you by creating the join tables and stuff like that. You don't need to worry about that.

For preloading the data you can also do this. It takes a bit of work but you can bundle a preloaded DB generated by CoreData and unwrap it at initial launch.

Which to use comes largely down to opinion (and so isn't a very good question for StackOverflow). There are some excellent tutorials on Core Data on the Ray Wenderlich site.

Worth reading through if you've never used CoreData before.

Fogmeister
  • 76,236
  • 42
  • 207
  • 306