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

对着背影说爱祢 提交于 2019-12-18 19:08:32

问题


I have ca onsumable product in my iTunes connect, and when I'm trying to buy it twice (on my iPhone), it tells me that I already bought it. But this is the whole point of consumables, that users can buy them over and over. Any suggestions?


回答1:


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].




回答2:


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


来源:https://stackoverflow.com/questions/26937195/in-app-purchase-when-trying-to-buy-consumable-product-again-this-in-app-purc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!