I want to develop an application. The functionality is similar to RSS feed reader. Read a XML from web service and display them in a table view. But I have some problems to deal with the local storage. I do not need to store all the history records since it takes a lot of storage. But I do want to store dozens of newest records so the user can really see something even when the new data is loading or there is no network connection. What should I do? Should I use Coredata or other methods?
问题:
回答1:
There are several ways to implement this storage within your iOS project (3 that I will mention here):
Core Data - Core Data is extremely powerful, and it could certainly handle your use case. There is some overhead in setting up your data model. You can read about Core Data here: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreData/index.html
SQLite Database - Your core data implementation would probably use SQLite as its persistent store. However, you also can use SQLite directly. This allows you to handle the data however you want, but it also requires a lot of overhead to get it up and running in the manner you mentioned above. This can be a good solution but, I don't think it is a good fit for your project. http://www.techotopia.com/index.php/An_Example_SQLite_based_iOS_4_iPhone_Application
Property List - Property lists are very easy to implement within a project for both reading and writing data. You can read more about property lists here: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html
Hope that helps.