I am currently developing an app where the user can rate (5 stars) different objects in the app. I am using parse.com to store all of the data (number of ratings, number of stars) online and it works great.
But what I would like to do is to also store the data locally on the user’s iPhone so that even if he doesn’t have an internet connection, there is still something displayed. And I would also store what this user rated.
Basically what I need is a local database that I can read and update easily. I have been reading quit a bit about it but I don’t know which one to use… Sqlite? XML file? Json?
Thank you for your help!
You can use Core Data, sqlite, a plist file, or any other kind of text or binary file. They would all work.
The choice comes down to choosing which one is best for your needs while allowing for possible future growth.
Is your data easily stored in an array of dictionaries? Then simply write the array to a file (plist). This works if the amount of data easily fits into memory.
Do you have a lot of data to read and write? Is the data too big to fit in memory? Is there no need to have all of the data in memory at once? Then use raw sqlite (or one of the various Objective-C wrappers) or use Core Data. Core Data has a huge learning curve but it gives some benefits over raw sqlite. Read about Core Data to see if it is worth the effort.