简体   繁体   中英

iOS App update new version delete files from Documents folder

I have written a new version (1.0.1) of the iOS application. The background of the application is that it download files from server and stores in Documents. As per Apple guidelines, any file generated by user shouldn't be backed up on cloud, therefore I have marked them as NSURLIsExcludedFromBackupKey. But now when I am updating on the device using Adhoc distribution profile, any user generated file in Documents folders are getting deleted.

Is there any way to avoid the deletion of those files, as these are essential files to have for application to run.

You seem to have things backwards. You should backup user-generated files. What you should not backup are files that can easily be replaced by downloading them again or generating them again as needed.

If you mark a file so it is excluded from backup then that means the file can easily be replaced.

When you install the app update, those files aren't copied over to the updated app. On first run, your app should detect that they are missing and automatically replace them if needed.

If these are files that can't be replaced automatically then do not flag them with NSURLIsExcludedFromBackupKey .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM