即将发布的应用程序:2个快速问题 [英] Approaching App Release: 2 Quick Questions

查看:51
本文介绍了即将发布的应用程序:2个快速问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着我接近发布我的应用程序,我正在尝试确保使用稳定的代码检查该应用程序之前是否已启动(以便执行一些首次设置).确定是否已启动该应用程序(显然不考虑应用程序版本和更新的简单方法)是否是一种坚如磐石的方式?

as I get closer to releasing my app, I'm trying to make sure that I'm using stable code to check if the app has been launched before (in order to perform some first time setup). Is this (obviously a no frills method that doesn't take into account app version and updates) pretty much a rock solid way to determine if the app has been launched?

在我的应用程序委托didFinishLaunchingWithOptions方法中,我每次执行以下操作:

In my app delegate didFinishLaunchingWithOptions method, I perform the following each time:

NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];

if(![defaults objectForKey:@"not_first_launch"])
{
    NSLog(@"This is the first time the app has been launched.\nPerforming first-time setup procedures...");
    [self runFirstTimeSetup];
}

我的第二个问题基本上是,我可以假设当我发布应用程序更新时,不会删除特定应用程序沙箱的用户文档目录吗?应用程序更新是否只是添加到目录中,而不是将其清除干净并重新安装?即使在更新应用程序时,我也仍然需要保留用户的文件(很明显),但是我不想做出错误的假设,并且每次发布更新时都会让用户丢失数据.

My second question is basically, can I assume that when I release an app update, that the user's documents directory for my specific app's sandbox will be left unerased? Does an app update simply add to the directory, not wipe it clean and re-install? I need the user's files to stick around even when I update the app (pretty obvious) but I don't want to make the wrong assumption and have users lose data every time I release an update.

谢谢!

推荐答案

是的,这很好地使用了NSUserDefaults.

Yes, that's a good use of NSUserDefaults.

用户数据通过更新保留.

User data is preserved through updates.

只需确保将应用程序随附的数据和运行期间生成的数据保存在单独的容器中.因此,如果您必须更改前者(通过应用程序更新),则后者保持不变.例如,不要将它们都放在同一个SQLite表中.

Just make sure you keep the data that comes with your app and the data generated during runs in separate bins. So that if you have to change the former (via an app update), the latter remains untouched. For example, don't put both of them in the same SQLite table.

这篇关于即将发布的应用程序:2个快速问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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