【问题标题】:What happens to files stored in the documents directory when an app is updated?更新应用程序时存储在文档目录中的文件会发生什么情况?
【发布时间】:2015-06-17 17:51:39
【问题描述】:

我无法在任何地方找到答案,但我正在使用归档将应用程序中的各种文件保存到文档目录中。如果我发布了应用程序的更新并且用户安装了它,这些文件会发生什么情况?他们会被删除吗?

获取文档的代码:

//get the directory
    NSArray *documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

   //set it to a string
    NSString *documentDirectory = [documentDirectories firstObject];


    return [documentDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@stickers.archive",[PFUser currentUser].username]];

【问题讨论】:

    标签: ios


    【解决方案1】:

    ,文件将保留
    然后,您可以继续将它们作为更新的一部分进行更改,或者像以前一样使用它们。

    但是你应该小心你如何引用保存的文件,因为更新后它们将在一个新目录中:App Updates, NSURL, and Documents Directory 基本上你应该只保存文档目录中的相对路径,它也将保持不变。

    【讨论】:

    • 谢谢!所以如果我访问上面的文件^(添加编辑)它会正常工作吗?
    猜你喜欢
    • 2019-10-05
    • 1970-01-01
    • 2014-03-05
    • 1970-01-01
    • 2014-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多