I am working on in app purchase which works fine but I want to know that user have purchased product or not at the launching time of application.
How should I know this. If anybody knows please help. Thanks in advance.
I am working on in app purchase which works fine but I want to know that user have purchased product or not at the launching time of application.
How should I know this. If anybody knows please help. Thanks in advance.
It would be best to get the user's purchase receipt and check all the products they have purchased.
You can follow the guide here to see how you can validate receipts locally.
This document explains the structure of the receipt - the in-app purchase fields have the product identifiers which can be used to find out which IAPs the user has access to.
You can store a "receipt" in the user defaults (
NSUserDefaults
) then check if the receipt exists when the app is launched.HOWEVER plainly using
NSUserDefaults
is prone to hacking so you can use a secure version of user defaults from here.another solution (and the recommended one if done correctly) will be to store receipts on a server and read available receipts when the app launches. (Note though that if the user has turned device data off you won't be able to read them).