Reputation: 51
My understanding of what happens to app data in each of the app folders is outlined below, can somebody confirm that I'm correct and if not, where to find Apple documentation on it. I'm having trouble finding enough information to verify.
My understanding is limited on what happens to data when the user upgrades their iOS. Is the data in folders that are backed up by iTunes/iCloud the only safe places for data? Meaning data in /Tmp and /Library/Caches will not be there once the user upgrades their iOS?
/Documents:
/Library:
/Library/Caches:
/Library/Preferences:
/Tmp:
Upvotes: 4
Views: 820
Reputation: 41005
This is broadly correct, however after iOS5, the contents of Library/Caches can be erased at any time if the OS decides that it's running low on disk space, so it's a bad idea to store anything in there long-term.
If you want to store cache data permanently on the device, but not have it backed up to iCloud, there is a new property called NSURLIsExcludedFromBackupKey that can be set on a file or folder located anywhere in Library or Documents that will prevent it from being backed up to iCloud.
I've written a simple library that manages the NSURLIsExcludedFromBackupKey for you, and provides constants for all of these folders with more meaningful names so it's easier to remember which ones to use for which purpose:
https://github.com/nicklockwood/StandardPaths
Upvotes: 1