如何确定用户首次购买/安装应用程序的时间(可能没有UDID的情况?) [英] How to find out WHEN a user bought the app / installed it for the first time (possible without UDID?)
问题描述
我想了解用户何时购买我的应用程序...到目前为止,我还没有找到一种干净的方法,而UDID似乎是唯一的选择.
I would like to find out when a user first bought my app... so far, I havent found a clean way and a UDID seemed to be the only option.
理想情况下,我会通过StoreKit收到一张收据,但到目前为止..nada
Ideally there would be a receipt I can get via StoreKit but so far.. nada
我错过了什么吗?有人有主意吗?
have I missed something ? Does anybody have an idea?
这种情况是我已经订阅了,并且出现了第一个问题(从您购买该应用程序开始就应该是免费的).如果我稍后再安装..我应该总是得到原始问题)
The situation is that I have a subscription and the FIRST issue (from the time you buy the app should be free). If I reinstall at a later time.. I should always get the original issue)
示例: 我在2010年10月购买了该应用 我安装并运行它,并免费获得10.2010版的订阅问题(无应用内购买) 现在我删除该应用程序 我安装了1.2013,而我仅从10.2010免费获得订阅!不是新的
example: I buy the app in 10.2010 I install and run it and get the subscription issue from 10.2010 for free (no in-app purchase) Now I delete the app I Install it 1.2013 and I only get the subscription from 10.2010 for free! NOT The new one
推荐答案
您只需将标志存储在钥匙串中即可.钥匙串的内容在重新安装应用程序后会保留.
You can just store a flag in the keychain. The contents of the keychain are preserved across app reinstalls.
要获取应用程序的首次安装时间,请检查何时将应用程序二进制文件首次写入磁盘:
To get the first installation time of your app, check when the first time the app binary has been written to disk:
if (flag_in_keychain_not_present()) {
// installed for the first time
set_flag_in_keychain();
struct stat st;
stat([NSBundle mainBundle].executablePath.UTF8String, &st);
time_t installed = st.st_mtime;
}
这篇关于如何确定用户首次购买/安装应用程序的时间(可能没有UDID的情况?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!