In App Purchase - when trying to buy consumable product again - this in-app purchase has already been bought

穿精又带淫゛_ 提交于 2019-11-30 17:26:09

This happens if you haven't marked the transaction for the original purchase as finished, which you should do in your - (void)paymentQueue:(SKPaymentQueue*)queue updatedTransactions:(NSArray*)transactions method after you've successfully processed the purchase.

The method you need to call is [[SKPaymentQueue defaultQueue] finishTransaction:transaction].

public func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
    for transaction in transactions {
        switch (transaction.transactionState) {
        case .purchased:
            complete(transaction: transaction)
            break
        case .failed:
            fail(transaction: transaction)
            break
        case .restored:
            restore(transaction: transaction)
            break
        case .deferred:
            break
        case .purchasing:
            break
        }
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!