Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SKPaymentTransactionObserver not getting a callback on app switch

I have in-app purchases set up so that when a user clicks on the buy button, a "Please Wait" view appears and adds a payment to the payment queue. This always causes an immediate callback of the queue's observer saying that the transaction entered the "Purchasing" state.

My problem happens when the user returns to the main screen before the confirm to purchase dialog pops up, then cancels. If I wait around on the main screen awhile before switching back to the application, the application never gets any callback about the transaction switching state or being removed. If I examine the payment queue, I can see that the transaction is still in the queue, still in the "Purchasing" state. Is there anything I can do to make it call back and remove it from the queue after resuming the application?

like image 848
Ed Marty Avatar asked Feb 08 '11 20:02

Ed Marty


1 Answers

If I understood your situation correctly, you've encountered this problem:

In App Purchase user cancels tx while app in background: tx state stays on purchasing

This appears to be a bug in Apple's Store kit. The issue can easily be reproduced if you send your app to background right after initiating a purchase and then pressing the cancel button when the buy confirmation popup is prompted. Your app will never receive the transaction failed(cancelled) notification and will enter a blocked state (if you disabled the UI trying to prevent the user from interacting with the app until the purchase has finished).

We have to wait for a fix from Apple. In the meantime, if your app is entering a blocked state because you disable UI while making a purchase; you should implement some mechanism to allow the user to leave that state.

Good luck!

like image 183
Lio Avatar answered Oct 28 '22 19:10

Lio