如何判断iOS应用程序是否已重新安装或更新? [英] How to tell if an iOS application has been newly installed or updated?

查看:498
本文介绍了如何判断iOS应用程序是否已重新安装或更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在应用程序商店有一个应用程序,我打算很快提交更新。

I have an application currently on the app store which I intend to submit an update for soon.

通过此次更新,我想添加代码,告诉应用程序首次运行时 application:didFinishLaunchingWithOptions 是否可以是:

With this update I want to add code which will tell the app when it first runs application:didFinishLaunchingWithOptions whether it is:


  1. 来自应用程序商店的新安装。

  2. 最新更新自以前的版本

目前应用程序商店中的应用程序中没有代码可以处理此问题。

该应用程序使用SQLite数据库,但由于我不会进入这里的原因,我不想使用检查它的存在作为这个问题的解决方案。

There is no code in the app currently in the app store to handle this.
The application uses a SQLite database, but for reasons I won't go into here I don't want to use a check for its existence as a solution to this problem.

作为一个附带问题,如果不手动存储数据,是否有可用于查询应用程序安装到设备上的SDK? (最好与iOS 3.0兼容)

As a side question, without storing the data manually, is there an SDK I can use to query when an app was installed onto a device? (Preferably iOS 3.0 compatible)

我见过类似问题,但没有一个答案适用于使用现有的应用商店代码。

I have seen a similar question, but none of the answers apply to working with existing app store code.

推荐答案

您可以将版本号保存到 NSUserDefaults ,并相应地更新。

You could save a version number to NSUserDefaults, and update it accordingly.

如果这不起作用,你可能会发布一个引入版本控制方案的中间版本。

If that won't work, you may be able to release an intermediate version which introduces the versioning scheme.

如果那样的话不是一个选项,您可以检查您创建的文件的先前运行痕迹,或者您有条件或懒惰地设置的首选项。

If that's not an option, you may be able to check for traces of previous runs from files you create, or preferences which you set conditionally or lazily.

这篇关于如何判断iOS应用程序是否已重新安装或更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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