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.
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:
.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With