1
votes

I'm stucked solving problem with In-App Purchases using StoreKit framework for Mac OS. The problem is this:

1) I call addPayment method when purchase started

2) Then updatedTransactions method called twice with transaction state SKPaymentTransactionStatePurchasing. And after second call [[SKPaymentQueue defaultQueue].transactions count] returns 2.

3) When purchase completed updatedTransactions called third time with transaction state SKPaymentTransactionStatePurchased. And [[SKPaymentQueue defaultQueue].transactions count] returns 3.

4) Then I finishTransaction with state SKPaymentTransactionStatePurchased. But in defaultQueue still remain two transactions with SKPaymentTransactionStatePurchasing. They alive till the app terminates. When I launch app again the problem repeats.

Why so many transactions for only one addPayment call? And how this problem can be solved?

1
You have to show some code or you can check my answer to this question which seams similar to yours. stackoverflow.com/questions/34167286/… - crashoverride777

1 Answers

1
votes

Make sure to call finishTransaction method after any of the below transaction state :

1) SKPaymentTransactionStatePurchased

2) SKPaymentTransactionStateFailed

3) SKPaymentTransactionStateRestored

[[SKPaymentQueue defaultQueue] finishTransaction:transaction];

Calling finishTransaction: on a transaction removes it from the queue.