Example: If I used this, where does the iPhone store the file?
if (![NSKeyedArchiver archiveRootObject:your_object toFile:@"filename.plist"])
// save failed.
On my mac the filename.plist goes to Macintosh HD directly. No folder. Also, the NSKeyedArchiver doesn't seem to ask for a path, just for a file name. Strange or not?
And how's that file backed up with iTunes?
archiveRootObject:toFile: (has been deprecated).
So you should pass it a path instead of just a filename. Otherwise NSKeyedArchiver
will assume you want to store it in the root of the devices hard disk.
Update:
With the data result generated with NSKeyedArchiver
, use the Data.write(to:options:)
instance method which writes the data object's bytes to the location specified by a given URL.