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

后端 未结 2 755
北海茫月
北海茫月 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

提交回复
热议问题