Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 439
process255 Avatar asked May 11 '12 21:05

process255


2 Answers

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

like image 76
Hyperbole Avatar answered Nov 16 '22 02:11

Hyperbole


I believe this is a bug with the sandbox App Store. My restores were not working with my test accounts (created in the iOS 5.0 era). -paymentQueue:updatedTransactions: was not getting called during a restore.

As suggested by process255's comment, I created a new test user in iTunes Connect. With the new test account, everything works fine!

like image 43
Ron Avatar answered Nov 16 '22 01:11

Ron