Where to save files in iOS 5 applications?

I heard that Apple has changed some things regarding memory management in iOS 5. So, where is the best place to save data and application files in the new iOS 5 application - without data loss?

+2
source share
3 answers

To add to what @Srikar said, keep only the data in caches if you can recover it. It was discovered that when a device is short-circuited in memory, it clears the application cache directory. This has been confirmed on various blogs and developers.

+1
source

I believe that you can save data in the Caches or Documents or tmp . The first 2 are actually supported (i.e. backing up data) iTunes automatically when connected 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 Documents or tmp same way. Hope this helps ...

+6
source

if iOS5 only considers using iCloud. For local storage, the iOS sandbox hasn't changed much, NSDocumentsDirectory (which is supported in iTunes).

+1
source

All Articles