Will data in a iOS applications Documents/ directory get erased when you kill the application's current instance?

306 views Asked by At

I am building an app and I am considering saving/writing some data to the applications Documents/ directory. I would like the data to persist across instances, meaning if a user kills the current instance of my application, whatever data I wrote to the Documents/ directory should remain.

In general, what types of application data gets purged when you kill an instance of an application?

1

There are 1 answers

1
Md. Ibrahim Hassan On BEST ANSWER

No it would be removed only when your app is uninstalled. Moreover files in Documents/ and Application Support/ are backed up by default. You can exclude files from the backup by calling -[NSURL setResourceValue:forKey:error:] using the NSURLIsExcludedFromBackupKey key. Any file that can be re-created or downloaded must be excluded from the backup. This is particularly important for large media files. If your application downloads video or audio files, make sure they are not included in the backup.

Further reading link

Hope this helps. Happy coding.