gpt4 book ai didi

ios - SKPaymentTransactionObserver 的 updatedTransactions 委托(delegate)方法中什么时候设置交易状态恢复?

转载 作者:行者123 更新时间:2023-11-28 14:10:49 27 4
gpt4 key购买 nike

我一直在测试应用程序内购买的代码,但在调用 updatedTransactions SKPaymentTransactionObserver 委托(delegate)方法时,我无法将交易状态设置为恢复。该方法何时调用该事务状态?

func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {

for transaction in transactions {
switch transaction.transactionState {
// Call the appropriate custom method for the transaction state.
case SKPaymentTransactionState.purchasing:
showTransactionAsInProgress(transaction, deferred: false)
case SKPaymentTransactionState.deferred:
showTransactionAsInProgress(transaction, deferred: true)
case SKPaymentTransactionState.failed:
failedTransaction(transaction)
case SKPaymentTransactionState.purchased:
completeTransaction(transaction)
case SKPaymentTransactionState.restored:
restoreTransaction(transaction)
}
}

}

最佳答案

如果您在 SKPaymentQueue 上调用 restoreCompletedTransactions 并且用户有可恢复的应用内购买,您将获得恢复的交易。查看reference documentation了解完整详情。

关于ios - SKPaymentTransactionObserver 的 updatedTransactions 委托(delegate)方法中什么时候设置交易状态恢复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52565319/

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