How to store and fetch the response of in-app purchase in ios?

后端 未结 2 633
北海茫月
北海茫月 2021-01-27 08:36

I have implemented in-app purchase in my project. The implementation worked well but I have a problem to store a response.

I unlocked the button and when I go through in

相关标签:
2条回答
  • 2021-01-27 08:54

    You need to implement it like.

    When the purchase is successful set a bool in NSUserDefaults like:

    [[NSUserDefaults standardUserDefaults] setBool:YES ForKey:@"isPurchased"];
    

    In the viewDidLoad of the class, write like:

    if([[NSUserDefaults standardUserDefaults] boolForKey:@"isPurchased"])
    {
       //Enable/show the button
    }
    else
    {
       //disable/hide button
    }
    

    This is a nice tutorial, please refer it also

    0 讨论(0)
  • 2021-01-27 08:55

    I have developed storekit for non consumable product. You can try it. ;)

    Happy coding!

    0 讨论(0)
提交回复
热议问题