Transaction comes back after finishTransaction: has been called on it

后端 未结 10 1156
一个人的身影
一个人的身影 2020-12-08 15:06

I am using in-app purchase for an iPhone app. I have a class that acts as SKProductsRequestDelegate and SKPaymentTransactionObserver, and it\'s all

10条回答
  •  孤城傲影
    2020-12-08 15:50

    That problem happened to me as well, I found the a solution. That may help you in similar cases.

    I was calling finishTransaction immediately but next time when I try to buy something, the previous product was coming as well! So at first time, I was buying one product. But at second time, I was buying the second product and the first product too.

    I found out that I'm adding SKPaymentTransactionObserver multiple times! That was causing the problem, making multiple buys.

    When the process ends, I mean when you call finishTransaction, right after that, call: [[SKPaymentQueue defaultQueue] removeTransactionObserver:self];

    That will clear out transactions and remove the observer. So next time, you won't make multiple buys.

提交回复
热议问题