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

查看:47
本文介绍了如何判断 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天全站免登陆