Reputation: 42622
I have a very simple question, I just can't find a proper answer. That's
[NSKeyedArchiver archiveRootObject:value toFile:filePath];
according to apple documentation here, the above function:
Archives an object graph rooted at a given object by encoding it into a data object then atomically writes the resulting data object to a file at a given path, and returns a Boolean value that indicates whether the operation was successful.
My question is, if I call this function multiple times with same file path, does it overwrite the previous value in this file? and Can I write empty array to the file by using this function?
Upvotes: 1
Views: 722
Reputation: 412
Yes, it will overwrite the previous value, and yes you can write an empty array to the file by using that function.
The implementation of that method doesn't care about what's there, it will overwrite whatever it is.
Upvotes: 2