gpt4 book ai didi

ios - SKReceiptRefreshRequest 与 restoreCompletedTransactions

转载 作者:技术小花猫 更新时间:2023-10-29 11:01:34 24 4
gpt4 key购买 nike

我的应用使用订阅模式,我收到一些用户无法通过 SKPaymentQueue.restoreCompletedTransactions 恢复订阅的投诉。他们必须删除应用程序并从 AppStore 重新下载。

我不太确定为什么它只发生在某些用户身上,其中一个用户告诉我他通过 iTunes 取消并重新激活,另一个是关于付款问题。

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

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

最佳答案

SKReceiptRefreshRequestRestoreCompletedTransactions 之间的区别非常简单:

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 & Restore completed transactions来验证用户订阅,但是在下面的情况下我们必须使用Restore completed transaction而不是刷新收据:

  • 如果您使用 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 与 restoreCompletedTransactions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40897238/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com