Question

I heard that apple changed some things, concerning the memory management in iOS 5. So where is the best place, to save app data and files in my new iOS 5 application - without losing data?

Was it helpful?

Solution

To add to what @Srikar have said, only save data in Caches if you can regenerate it. It has been found that when the device is running short on memory it clears off the app's cache directory. This has been confirmed on various blog post and developers.

OTHER TIPS

I believe you can save data in either Caches or Documents or tmp directories. The former 2 are actually backed by (i.e. data backup) by iTunes automatically when you connect to it.

For example this code accesses the Caches directory -

NSArray *cachesDirList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cacheDir = [cachesDirList objectAtIndex:0];

You can experiment with either Documents or tmp in similar fashion. Hope this helps...

if it's iOS5 only consider using iCloud. For local storage iOS sandbox hasn't changed much, NSDocumentsDirectory (which is backed up to iTunes).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top