开发者

Does NSKeyedArchiver overwrite the entire file every time you archive?

开发者 https://www.devze.com 2023-01-20 17:11 出处:网络
I need to store various types of data and update it from different parts of my application at different times.I was under the impression I could use NSKeyedArchiver to do this and just update parts of

I need to store various types of data and update it from different parts of my application at different times. I was under the impression I could use NSKeyedArchiver to do this and just update parts of the data using the appropriate key when necessary...much like a database. It seems that NSKeyedArchiver overwrites the entire file every time you archive.

Am I correct in that NSKeyedArchiver overwrites the entire file and if so, is there a strategy you would suggest for dealing with this (other than using SQLLite 开发者_开发百科or CoreData..I'll probably have to upgrade to this for the next release). I can separate out the data into different files but that seems like a lot of work.


Yes, NSKeyedArchiver replaces the data on disk with its data. To do what you want will probably take SOME sort of database solution, though not necessarily SQLite. How large is your data set? Is re-writing the whole thing that slow?

0

精彩评论

暂无评论...
验证码 换一张
取 消