Storing data locally on iPhone
I'm developing an iOS app, which is my graduation project.. the app is supposed to serve as a social network, where the user could connect to other users. From the data perspective the app needs to store some data locally, and it also have the ability to update these data with a remote server, i.e. the local data are snaps开发者_如何学运维hots of a subset of the data that located on the server..
Let's say that the user is able to connect to at most 100 other users, and he/she is also able to see their information, and these info are : textual and small images about each connected user.
I'm wondering what's the most efficient approach to store these data, I've looked at :
- plists
- NSUserDefault
- SQLite3
- Archiving
- Core Data.
But couldn't decide which approach is suitable for my app.
Thanks in advance.
I would go with CoreData & SQLite ... But we haven't all details of your application, thus, I can be wrong.
You want either SQLite or Core Data. And between those in your particular case, use SQLite. Flexible to work with and you can use the SQL knowledge and SQL data on other platforms. Using SQL both locally and on the server side, should make your development most effective.
Core Data and archiving. I'm not sure if you make a NSManagedObject conform to NSCoding, but if you can use core data on the client side, and then convert to plists (or your own Custom format) for transport over the wire.
Either way, the goal is to a have a parent model class that can serialize all of it's properties.
I know of the Zsync framework for sync'ing data with local and remote core data stores, however I don't believe it works on iPhone
I think that a simple and effective approach is to use sqlite3 and it is very familiar for a developer (as he uses to develop with sql language).
精彩评论