ios – SKReceiptRefreshRequest vs restoreCompletedTransactions

ios – SKReceiptRefreshRequest vs restoreCompletedTransactions,第1张

概述我的应用程序使用订阅模式,我收到投诉,其中一些用户无法通过SKPaymentQueue.restoreCompletedTransactions恢复订阅.他们必须删除应用程序并从AppStore重新下载. 我不确定为什么它只发生在一些用户身上,其中一个告诉我他通过itunes取消并重新启动,另一个关于付款问题. 那么为什么他们需要重新下载应用程序呢?我猜测一些信息在收据上没有正确刷新,所以我考虑使 我的应用程序使用订阅模式,我收到投诉,其中一些用户无法通过SKPaymentQueue.restoreCompletedTransactions恢复订阅.他们必须删除应用程序并从AppStore重新下载.

我不确定为什么它只发生在一些用户身上,其中一个告诉我他通过itunes取消并重新启动,另一个关于付款问题.

那么为什么他们需要重新下载应用程序呢?我猜测一些信息在收据上没有正确刷新,所以我考虑使用SKReceiptRefreshRequest而不是restoreCompletedTransactions,或者可能同时使用两者.

有人可以解释这两个过程之间的差异吗?

解决方法 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

总结

以上是内存溢出为你收集整理的ios – SKReceiptRefreshRequest vs restoreCompletedTransactions全部内容,希望文章能够帮你解决ios – SKReceiptRefreshRequest vs restoreCompletedTransactions所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1114783.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存