tags:

views:

145

answers:

1

As "suggested" by Apple, I have put a button on my application, to restore old successful transactions, in my in-app purchase application.

The problem is this. The user clicks the button and the application starts restoring the transactions. If the application is closed for some reason during this process, the process will continue the next time the application runs.

In my case, restoring all transactions can take some time, specially if the user has many transactions. So, when the application starts again, I see a black screen and the application do not loads until the last transaction is restored.

Apparently the process of restoring the transactions hangs the application that do not loads until it finishes.

As Apple recommends, I have this, on the beginning of my app...

CustomStoreObserver *observer = [[CustomStoreObserver alloc] init];
[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

This is useful for restoring interrupted sales but in my case is causing a pain when the question is restoring old transactions already bought.

I would like to be able to abort any restoration of old transactions that could run, when the program starts and just allow them while toe app is running.

Any way to do that?

+1  A: 

Can you not create the store observer in a different thread/run loop so that it doesn't block the UI thread?

Failing that, only add the transaction observer after you have made a splash screen visible?

Simon
thanks...yes, I have thought about that. That would solve just the hang part but the transactions would continue to use cpu and slow down the app...
Digital Robot
Sorry I can't help then. I am guessing the SK is not expecting an app to have lots of transactions.Mitigating this, the user should only have to start this process if transactions fail to complete (which hopefully is rare) and the app quits. At least if it is a user initiated action and your app reaches the splash screen, the client should be more accepting of the delay.
Simon
Possibly an unhelpful comment but perhaps you should consider charging more per transaction so that the volume of transactions is lower, maybe offering a pack of items at slightly lower cost than when bought individually to encourage people to buy more and make fewer transactions.
Simon