如何检测是否有应用内购买还原?

时间:2021-02-08 00:06:01

I'm letting user click a restore button to call restoreCompletedTransactions.

我让用户点击恢复按钮来调用restoreCompletedTransactions。

While performing the restore, I'd like to put a HUD.
How do I detect whether there's something to restore and if restore process has finished(if there was one) so that I can hide the HUD?

在执行恢复时,我想放一个HUD。如何检测是否有要恢复的内容以及恢复过程是否已完成(如果有)以便我可以隐藏HUD?

1 个解决方案

#1


1  

The - paymentQueueRestoreCompletedTransactionsFinished: message will be sent to the SKPaymentQueues transaction observers when the process has finished, if successful. If it failed, it the messsage - paymentQueue:restoreCompletedTransactionsFailedWithError: will be sent.

- paymentQueueRestoreCompletedTransactionsFinished:消息将在进程完成时发送给SKPaymentQueues事务观察者,如果成功的话。如果失败,将发送消息 - paymentQueue:restoreCompletedTransactionsFailedWithError:。

There's no way to immediately determine whether there are any transactions to restore, so you would generally throw up the "Please Wait..." HUD right away. Then the payment queue has to go check to see if there are any transactions to restore, and restore them. Whether there are any to restore or not, one of the messages above will still be sent, so you can then hide your HUD.

没有办法立即确定是否有任何要恢复的交易,所以你通常会立即抛出“请等待......”HUD。然后,支付队列必须检查是否有任何要还原的事务,并将其还原。无论是否有任何恢复,上面的消息之一仍然会被发送,因此您可以隐藏您的HUD。

#1


1  

The - paymentQueueRestoreCompletedTransactionsFinished: message will be sent to the SKPaymentQueues transaction observers when the process has finished, if successful. If it failed, it the messsage - paymentQueue:restoreCompletedTransactionsFailedWithError: will be sent.

- paymentQueueRestoreCompletedTransactionsFinished:消息将在进程完成时发送给SKPaymentQueues事务观察者,如果成功的话。如果失败,将发送消息 - paymentQueue:restoreCompletedTransactionsFailedWithError:。

There's no way to immediately determine whether there are any transactions to restore, so you would generally throw up the "Please Wait..." HUD right away. Then the payment queue has to go check to see if there are any transactions to restore, and restore them. Whether there are any to restore or not, one of the messages above will still be sent, so you can then hide your HUD.

没有办法立即确定是否有任何要恢复的交易,所以你通常会立即抛出“请等待......”HUD。然后,支付队列必须检查是否有任何要还原的事务,并将其还原。无论是否有任何恢复,上面的消息之一仍然会被发送,因此您可以隐藏您的HUD。