views:

21

answers:

2

Hello!

I am currently using a P-List to save data in a game I'm developing. I'm curious about something though.

Maybe this is a stupid question: but each time I write to the P-List, is it overwritten? If that is the case, and it just doesn't automatically ADD (i.e. appending) values to it, then that would be perfect.

Thank you for your replies. :D

A: 

Yes, it is overwritten. If you want to add to it, you have to use the NSMutableArray/NSMutableDictionary classes and keep it around, then add to it and write the file each time.

Alternatively, you might consider using Core Data...

jtbandes
+1  A: 

Yes, when you write the property list with either NSDictionary#writeToFile:atomically: or one of the methods in NSPropertyListSerialization then your file will be completely overwritten.

So this means tht if you just want to update a single value in it, that you will have to read it in completely, change the value and then write it out again.

St3fan