Search code examples
iosnsuserdefaultsicloud

Save user defaults to iCloud


I don't have any important data in my app. But when i read this tutorial i have a few questions ?

Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the /Documents directory and will be automatically backed up by iCloud.

Do i need to save UserDefaults to iCloud ? And will my app approve if i don't use iCloud ?

And if i need can you show me how to save user default settings ? Because i found only tutorials how to save data from database.


Solution

  • You misunderstand what that is saying.

    When a user backup's up their devices using iTunes or iCloud, only certain parts of the app's sandbox is backed up. So there are two important aspects here:

    1. Only backup data that can't be replaced.
    2. Be sure to backup irreplaceable data.

    NSUserDefaults is one of the things that will be backed up for you. You don't need to do anything special.

    You don't need iCloud support unless your app has a specific need to use it.