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.
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)
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;
}
I haven't used Store Kit yet, but tell me if I'm wrong,
1) it requires a server at a point or another
2) when we use it to "buy" (not a subscription or a consumable) something we can retrieve this purchase on all devices using the same iTunes Account
My point, create a in app purchase free item, when it passes through you server the first time store it in a database and next time it is called with the same account "enable" the issue corresponding to the first free purchase
来源:https://stackoverflow.com/questions/16354886/how-to-find-out-when-a-user-bought-the-app-installed-it-for-the-first-time-po