Reputation: 303
I have a .plist with one array and in this array i have some NSDictionary in it. Now I want to change in my Dictionary some Values. My Idea is to load the whole array, find the value, change it, and write over the whole array. but it cost a lot of time. Do you know a better way to change special values.
Upvotes: 0
Views: 165
Reputation: 14304
There's no time issue here. Let's talk big-O notation:
O(log(n))+O(log(n))+O(c)=O(log(n))
So you are 'stuck' with O(log(n)) which isn't bad at all.
Upvotes: 2
Reputation: 6753
If you're going to persist data using a .plist, there's no alternative than to write out the whole file if you make a change.
An alternative for storing large amounts of data that would allow you to update individual records would be to use CoreData - which is effectively a database stored on the device.
Core Data is a lot more complicated than using a plist, but more scalable, and all the other benefits that come with using a database.
Upvotes: 1
Reputation: 900
How big is the plist? How often do you do it? It shouldn't be a performance problem..
Upvotes: -1