简体   繁体   English

iOS App更新新版本从Documents文件夹中删除文件

[英]iOS App update new version delete files from Documents folder

I have written a new version (1.0.1) of the iOS application. 我已经编写了iOS应用程序的新版本(1.0.1)。 The background of the application is that it download files from server and stores in Documents. 该应用程序的背景是它从服务器下载文件并存储在Documents中。 As per Apple guidelines, any file generated by user shouldn't be backed up on cloud, therefore I have marked them as NSURLIsExcludedFromBackupKey. 根据Apple指南,用户生成的任何文件都不应在云上备份,因此我将其标记为NSURLIsExcludedFromBackupKey。 But now when I am updating on the device using Adhoc distribution profile, any user generated file in Documents folders are getting deleted. 但是现在当我使用Adhoc分发配置文件在设备上更新时,Documents文件夹中的任何用户生成的文件都将被删除。

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 . 如果这些文件无法自动替换,请不要使用NSURLIsExcludedFromBackupKey标记它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否有 API 可以从 iOS 应用程序的文档文件夹中复制文件? - Are there APIs to copy files from an iOS app's documents folder? 在iOS应用程序的/ Documents /文件夹中提供初始文件 - Providing initial files in /Documents/ folder in an iOS app iOS 文档文件夹中包含文件的应用程序大小 - Size of app with files in documents folder iOS 无法从应用程序文档文件夹中删除文件 - unable to delete file from the app documents folder 从本地应用程序Documents文件夹中删除文件 - Deleting files from local app Documents folder 在iPhone应用程序终止时删除文档文件夹中的文件 - delete files in documents folder when iphone app terminated Phonegap + jQuery mobile:使用jQuery Mobile从iOS应用程序的Documents文件夹中注入html文件 - Phonegap + jQuery mobile: injecting html files from iOS app's Documents folder with jQuery Mobile 如何将文件文件夹从IOS App捆绑资源复制到Documents Directory - How to copy a folder of files from IOS App bundle resources to Documents Directory 更新iOS应用程序时,Documents文件夹内容会发生什么变化? - When you update an iOS app, what happens to the Documents folder contents? 更新后,应用程序不会从“文档”文件夹中加载现有文件 - After Update, App Doesn't Load Existing Files from Documents Folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM