如何确定应用程序首次安装或使用的日期? [英] How to determine the date an app is installed or used for the first time?

查看:40
本文介绍了如何确定应用程序首次安装或使用的日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划开设一个应用商店,我想免费为现有用户提供一些项目.

I'm planning on opening up an in app store and I'd like to give existing users some of the items for free.

我想发布一个更新,在第一次使用该应用程序时存储一些信息,然后发布真实"更新,看看该应用程序是否之前购买过,但是,很可能不是每个人都会选择第一次更新.

I thought of releasing an update which would store some informaion the first time the app is used, then release the "real" update that'd look if the app was purchased before, however, it's likely that not everyone will opt for the first update.

那么,有没有办法找出用户第一次安装(或使用)该应用的确切时间?

So, is there a way to find out when exactly a user has first installed (or used) the app ?

更新:

感谢您的回答,但我应该让它不那么模棱两可:

Thanks for the answers, but I should make the it less ambiguous :

我正在寻找本地调用/任何类似的方法.由于该应用程序已经在商店中并且我没有设置任何东西来存储第一个版本的数据,如果所有用户在第二次更新之前获取它,更新将帮助我做我想做的事已发布:无法将新用户与错过中间更新且刚刚更新到最新用户的现有用户区分开来.

I'm looking for a native call/anything similar to do it. Since the app is already on store and I haven't set up anything to store the data on the first version, an update will help me do what I want if all the users grab it before the second update is released : It'd be impossible to distinguish a new user from an existing one who had missed the intermediary update and has just updated to the most recent one.

推荐答案

我的解决方案是检查 app bundle 中某个文件的最后修改日期.

My solution would be to check the last modified date of one of the files in the app bundle.

NSString *sourceFile = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Icon.png"];

NSDate *lastModif = [[[NSFileManager defaultManager] attributesOfItemAtPath:sourceFile error:&err] objectForKey:NSFileModificationDate];

这篇关于如何确定应用程序首次安装或使用的日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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