I have a NSMutableArray
, and I write it to a plist file using writeToFile: atomically:
. The elements in the array are all property list objects.
Then in my iPhone App, I meet a case: when the NSMutableArray
needs to add an object and I also want to update the plist file. Now what I do is to call writeToFile: atomically:
when an new one is added.
However when the code>NSMutableArray has a large mount of data, it 开发者_如何转开发must be in poor performance. SO I wonder how to write the newly added element to the existed plist file.
Thanks.
PS: the business logic is:
When the user does some action,like sending a new message or add a new photo, I'll make a record of user,message/image data and time(all is property list objects). The Action can be happen everywhere, and I didn't create the array to check the actions always (and it is in no need). Of course I use sqilte to do it, but I also need a plist file, so that user's friends can download it whenever they want. The friends need no request from the user and just download it. So I plan to keep an up-to-date plist file. That's all why I need it.
If there comes a stage when plist
files turn in poor performance and you've to worry about adding the data incrementally, you must actually be looking at Core Data
.
精彩评论