更新iOS应用程序是否会删除库目录文件? [英] Does updating iOS apps delete library directory files?

查看:437
本文介绍了更新iOS应用程序是否会删除库目录文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将文件保存在我的iPad应用程序的私人目录中,即我使用时返回的文件:

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"]; 

请注意,我还附加了一个子目录。当我更新应用程序时,用户告诉我他们在应用程序中的进度正在被破坏。每次更新应用程序时,是否会破坏此NSLibraryDirectory中的文件?如果是这样,我应该使用NSDocumentDirectory吗?

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.

推荐答案

您应该将它们保存在Documents文件夹中,它在更新中是持久的。

You should save them in the Documents folder, it is persistent across updates.

Monotouch: documentsDirectory = environment.specialfolder.personal;

Monotouch: documentsDirectory = environment.specialfolder.personal;

Objective-C: NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)

Objective-C: NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)

这篇关于更新iOS应用程序是否会删除库目录文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆