7

Is the application domain in [NSUserDefaults standardUserDefaults] backed up when the user synchs their device? If not, can you suggest a close correct alternative?

Apple makes reference to "Application Preferences" in its documentation, such as regards in-app purchasing. I understand, perhaps incorrectly, that they're making reference to NSUserDefaults here although the terminology doesn't appear to match perfectly.

In-app purchases, which I plan to record in [NSUserDefaults standardUserDefaults], need to be backed up in my project.

Thanking you kindly in advance.

Ken
  • 30,811
  • 34
  • 116
  • 155

1 Answers1

10

Yes. NSUserDefaults uses a PLIST file as a backing store, which is backed up on each sync. See http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/UserDefaults/Concepts/DefaultsDomains.html for more information.

If you wanted to see for yourself, you could check out ~/Library/Application Support/MobileSync/Backup/. Create an unencrypted backup of a device with just your app on it, and view the files in the PLIST editor.

Jeremy Massel
  • 2,257
  • 18
  • 22
  • 1
    Thank you for your post. I'm paranoid about this, so I will be checking ~/Backup. – Ken Jan 26 '11 at 05:06
  • if you want to be crazy secure, store this data on a database outside the device. that way if they fail to back up their device, they can restore from the server. The defaults are backed up (you can test this by backing up, then restoring from backup as well on a device), but if you want to cover all your bases, this is another way to go – Jeremy Massel Jan 26 '11 at 05:09
  • I'm happy not to take responsibility for the user to backup on this occasion, just so long as I clearly give them the chance to do so. That's good enough for my purposes. (Posting another question in a few minutes...) – Ken Jan 26 '11 at 06:42