Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does updating iOS apps delete library directory files?

Tags:

file

ios

I keep save files in a private directory in my iPad app, namely the one returned when I use:

paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
documentsDirectory = [paths objectAtIndex:0];
documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"Private Documents"]; 

Notice that I also append a subdirectory to it. When I update the app, users are telling me that their progress in the app is getting destroyed. Are files in this NSLibraryDirectory destroyed every time I update the app? If so, should I be using NSDocumentDirectory instead?

Additionally, is there no way to make a further update to my app to remedy this without destroying all my my current users' save files? It doesn't seem like there is.

like image 230
Joey Avatar asked Feb 25 '11 21:02

Joey


People also ask

How do I delete iOS apps without deleting data?

If you want to delete an app but don't want to delete all its data, you can choose to offload it instead. This deletes the app, but keep all the data it has created on your iOS device. To offload an app, go to Settings > General > iPhone Storage (or iPad Storage).

Does software update delete data iPhone?

As mentioned earlier, a software update does not erase data from your device, and everything is preserved during and after the iOS update. A power outage or a system error can interrupt the update process, and these are some scenarios where you could lose your existing data.

Where do iOS apps store data?

iOS apps store data locally in different ways like plist(similar to shared_pref in android), NSUserDefaults, Core data(sqlite), Keychain. Theses files can be found using any file explorer utility under the application folder.


1 Answers

When a user downloads an app update, iTunes installs the update in a new app directory. It then moves the user’s data files from the old installation over to the new app directory before deleting the old installation. Files in the following directories are guaranteed to be preserved during the update process:

Application_Home/Documents

Application_Home/Library

Although files in other user directories may also be moved over, you should not rely on them being present after an update.

This is provided by apple officially. See this link : iOS Developer Library - File Saved During App Updates

like image 187
Vineeth Avatar answered Nov 13 '22 03:11

Vineeth