SKPaymentTransactionStateRestored doesn't get called when In App purchase is being restored

前端 未结 4 1289
抹茶落季
抹茶落季 2021-02-15 11:09

In my In App purchase the case SKPaymentTransactionStateRestored: method does not get called when the purchase is restored, instead, case SKPaymentTransaction

4条回答
  •  名媛妹妹
    2021-02-15 11:22

    In case, it's not solved yet, you might do it with a logical trick. When the restore is beeing triggered, remember it with a boolean flag (or a enum state, if you prefer) and show a different message when the SKPaymentTransactionStatePurchased is beeing triggered. You might implement the two delegate methods

    - (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
    

    and

    - (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error
    

    to find out, when the restore has been finished. And to be save in this case, you might not let the user make any purchases, while the restore is in progress. You could show the user something like this, so the user sees, that something is currently happening.

    This is what i did and it works for me.

提交回复
热议问题