In App Purchase - when trying to buy consumable pr

2019-02-12 04:08发布

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?

2条回答
Summer. ? 凉城
2楼-- · 2019-02-12 04:59

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

查看更多
forever°为你锁心
3楼-- · 2019-02-12 05:06
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
        }
    }
}
查看更多
登录 后发表回答