问题
I'm trying a new market strategy so I'm gonna put my 0,79€ App now for free, with an in-App purchase that unlock ALL the contents. I also do not want to betray the users which already has bought it, so I thought to implement a check where who already have bought the App, don't need to purchase the in-App payment to unlock all.
My problem is... can I check when the App has been purchased? Or maybe there is a simple way?
回答1:
You can't do this with any certainty, since there is no way to check if the user bought the app because there is no way to ask the OS about the install/purchase date.
As suggested, you could save it in the NSUserDefaults, but if the user deletes the app, this information is lost.
One could save it in the keychain, which is not cleared if you delete the app, but the problem is still there, because if the iOS device gets restored, these settings could be lost.
回答2:
just to update this, it IS possible. Take a look at the answer to this question -- one of the fields in the receipt is "original purchase date"
A complete solution to LOCALLY validate an in-app receipts and bundle receipts on iOS 7
回答3:
rckoenes explanation is correct. I've been through such scenario lately and I've considered the options mentioned in the answers here. The option I end up with is to release another extension of app (like 'pro' or 'lite' etc.) instead of a version of existing app. That would cut off all the hassles of handling the purchase status of your app. Then you'd have a full paid version of app with all premium content and one free version with In-App purchases to unlock the content. Hope that'll help.
回答4:
Assuming your current version of the application saves state, on the first launch of the next version of the application, you can check for any saved state (e.g. a key in NSUserDefaults, a file in the documents directory, etc.)
You should only do this once though, so you need to have another flag somewhere else to tell you that the check has been performed.
回答5:
This should be pretty straightforward. If you know when your new app comes online, you just check for the installation date/time (store the date/time in the keychain upon first run). Users that installed the app before the date/time your free app came online can access content. If you are worried about new users messing with the date/time, use an online time service to get the actual time.
来源:https://stackoverflow.com/questions/10982806/ios-app-purchase-date