Reputation: 12949
I'm currently working on a Google Reader application on iOS and I would like to know what is the best way to store all the previously downloaded data (which could go up to thousands of news) ? I heard of Core Data, is it the way ? Or would it be easier to store an XML or JSON file and to parse it ?
Thank you
Upvotes: 1
Views: 1212
Reputation: 4229
Core Data is in general a good way to go for handling large amounts of data, esp with complex relationships.
In this particular case however you can stand on the shoulders of giants. NetNewsWire is a iOS RSS radar (that uses google reader), and it used Core Data for a while and switched away from it. The then-author of NewNewsWire was kind enough to write why in http://inessential.com/2010/02/26/on_switching_away_from_core_data
I don't think any of that would have changed, so unless your RSS reader is very different from NetNewsWire it will be faster if it avoids Core Data and uses sqlite (directly, or via some framework like FMDB). I'll also bet that you will be "faster to market" if you use Core Data and take the performance hit.
(now the focus of your RSS program may be very different, and so maybe you will never need to do the equivalent of update newsItems set read = 1 where
for 10,000 items or any of the other things where Core Data hinders more then helps -- if so, by all means run to Core Data)
NOTE: things have changed a bit since this answer was written. iOS 8 has added some support for bulk operators that bypass some of this, see NSBatchUpdateRequest for example. I don't have direct experience with it, and you would need to drop iOS 7 and prior support (or write the code twice, and only work well for large datasets on iOS 8+). Also all the warnings about using "new" things apply ("not as well tested", "not as many places to turn to for help"), offset of course by it maybe being a perfect fit for your problem, and Oooo Shiny!
Upvotes: 2
Reputation: 605
Yes you are correct. Unless you have taken the time to learn some SQLite, XML, or JSON... using Core Data is by far the best and easiest option to implement. It is created by Apple for Apple applications and operating systems. There is very good documentation and sample code at www.developer.apple.com under Core Data. Start here: Core Data Programming Guide on developer.apple.com
Upvotes: 1
Reputation: 2258
Use core data. It's perfect for what you are needing. Look up the documentation and there's plenty of sample code available (you can even start a new project in Xcode and select the core data option to have it populate the app delegate with all the required core data code for you.
Upvotes: 1