Reputation: 15
I want to copy my NSDictionary's data into plist and also edit some data which are into the plist .So , how should I do that ?
Upvotes: 0
Views: 261
Reputation: 39988
Use writeToFile:atomically:
to write the dictionary in your document directory and if you want to edit it then get the dictionary using dictionaryWithContentsOfFile:
edit it and then save it again using writeToFile:atomically:
.
overwriting may cause some problem but if problem comes you can remove the file first then write it again.
Upvotes: 0
Reputation: 10182
Use NSMutableDictionary
's +dictionaryWithContentsOfFile:
to read the plist and be able to edit it.
Then to write it to a file use -writeToFile:atomically:
This is all clearly outlined in the NSDictionary
documentation. Always consult the documentation before posting.
Upvotes: 1