In my AppDelegate, I run this command:
SKPaymentQueue.defaultQueue().addTransactionObserver(self.storeDel);
When I run "purchase recovery" and kill the app immediately, after restarting it the user interface is getting stuck for the period of time it takes to process all the purchases (and I tested many of them, for each I verify the receipt with apple - it takes about a minute of stuck UI!!)
I thought it might be that the transaction queue startup is blocking.. so I changed the code to:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), {
SKPaymentQueue.defaultQueue().addTransactionObserver(self.storeDel);
});
And it didn't help....
By now - I became suspicious the queue runs on my main thread... which doesn't make sense to me...
I debugged - and ... the payment processing is running on "Queue: com.apple.main-thread (serial)". I assume this is also the user GUI thread (otherwise there is no reason for the GUI to get stuck...).
SO...
What can I do?? Is there any solution I can process receipts and be responsive... ?
Thanks!
I contacted Apple, tried to open a bug report regarding this issue.
They said, generically speaking, that this is the expected behavior (YES!! MY GUI IS SUPPOSE TO BE STUCK WHILE PROCESSING PAYMENTS).
If that bugs you too, http://bugreport.apple.com is the web site to open service request regarding this issue.
I think it's a flawed design, and that it is a bug, Apple think it is acceptable.