我不确定为什么它只发生在一些用户身上,其中一个告诉我他通过itunes取消并重新启动,另一个关于付款问题.
那么为什么他们需要重新下载应用程序呢?我猜测一些信息在收据上没有正确刷新,所以我考虑使用SKReceiptRefreshRequest而不是restoreCompletedTransactions,或者可能同时使用两者.
有人可以解释这两个过程之间的差异吗?
解决方法
SKReceiptRefreshRequest
Refreshing the receipt asks the App Store for the latest copy of the
receipt. Refreshing a receipt does not create any new transactions.
Although you should avoid refreshing multiple times in a row,this
action would have same result as refreshing it just once.
RestoreCompletedTransactions
Restoring completed transactions creates a new transaction for every
completed transaction the user made,essentially replaying history for
your transaction queue observer. While transactions are being
restored,your app maintains its own state to keep track of why it’s
restoring completed transactions and how it needs to handle them.
Restoring multiple times creates multiple restored transactions for
each completed transaction.
我们可以同时使用SKReceiptRefreshRequest&恢复已完成的事务以验证用户订阅,但在下面的情况下,我们必须使用恢复已完成的事务而不是刷新收据:
>如果您使用Apple托管的内容,则还原已完成的事务会为您的应用程序提供用于下载内容的事务对象.
>如果您需要支持早于iOS 7的iOS版本(应用程序收据不可用),请恢复已完成的事务.
>如果您的应用使用非续订订阅,则您的应用负责恢复过程.
参考:https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html#//apple_ref/doc/uid/TP40008267-CH8-SW9