paymentQueueRestoreCompletedTransactionsFinished: is returning an empty queue when it should have transactions in it

ios, objective-c, storekit

Solution

Are you handling the transactions in `-paymentQueue:updatedTransactions:`? This callback gets your restored transactions before the `paymentQueueRestoreCompletedTransactionsFinished:` callback.

You should do your restore processing and handling inside `-paymentQueue:updatedTransactions:`.

Problem

This is my first time using Store Kit and everything has gone great up until I attempt to restore purchases. I've seen several other posts on stack overflow about similar issues but I've not found a solution that works for me. I have a button in my app that calls `[[SKPaymentQueue defaultQueue] restoreCompletedTransactions]`. This in turn triggers the `SKPaymentTransactionObserver` method `paymentQueueRestoreCompletedTransactionsFinished:`. The problem is that `paymentQueueRestoreCompletedTransactionsFinished:` has zero transactions in the returned queue. If I then attempt to make the purchase I am notified that I have already made the purchase. This tells me that the store knows that my test Apple ID has successfully made the purchase on a previous attempt. Why then does `paymentQueueRestoreCompletedTransactionsFinished:` return an empty transactions collection on it's queue? There has been some mention of the sandbox behaving erratically but I need to see this working before I go live to the AppStore. Any ideas? Am I missing something? Thanks in advance.

Original source