问题
I have used this tutorial and wonder how to check which of the products the user just bought. I saw in the end of the tutorial:
The resources zip for this tutorial contain images for all of the the comics, so if you’re so inclined you can wrap it up by showing the comic in a new view controller when a purchased row is tapped! If you want to do this, you can just check if the productIdentifier is in the purchasedProducts array of the InAppRageIAPHelper before allowing the user access to the content.
But I tested but it wasn't a success. I wonder if you know how to do it. Thanks for your time!
回答1:
One way could be to store purchased identifiers with NSUserDefaults.
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"YourIdentifier"];
[[NSUserDefaults standardUserDefaults] synchronize];
You can then check when the app starts which identifiers has been bought
[[NSUserDefaults standardUserDefaults] boolForKey:@"YourIdentifier"];
来源:https://stackoverflow.com/questions/18035040/check-which-product-the-user-bought-on-an-in-app-purchase