Check which product the user bought on an In-App Purchase

坚强是说给别人听的谎言 提交于 2020-01-14 03:47:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!