0

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

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)
        }
    }

}
4

1 回答 1

1

如果您调用并且用户有可恢复的应用内购买,restoreCompletedTransactions您将获得恢复的交易。SKPaymentQueue有关完整的详细信息,请参阅参考文档

于 2018-09-29T05:24:44.400 回答