Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone store kit : how to catch cancel event

Here's my problem :

When using storekit for in-app purchase, i'm displaying a "loading" view to tell the user to wait for a few seconds while the process is in progress; but let's say this same user, when the storekit ask him for his itunes account password, press the "cancel" button... How can i "catch" this event in order to hide the loading view?

I'm afraid it could be a cause of rejection for Apple since user's communication is pretty important.

Thanks for any tips!

Edit : I'm not in a transaction here; my first step is to restore completed transactions so the password prompt is trigger by this method :

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions]
like image 477
Vivi Avatar asked Dec 13 '22 01:12

Vivi


1 Answers

Something similar was reported in the Apple dev forums.

What happens when user hits Cancel after asking to restore......

In their case, a copy-and-paste of a method from the documentation created a bug that apparently compiled without error.

// wrong, but compiles
- (void)paymentQueue:(SKPaymentQueue *)queuerestoreCompletedTransactionsFailedWithError:(NSError *)error

instead of

// correct
- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error

If your observer method looks like the first one above, then you're probably not receiving the failure message for the restore operation.

Update:

In SDK documentation for SKPaymentTransactionObserver, I see the restore failure method for OS 3.1 (2009-11-17) but 3.0 documentation (2009-05-01) doesn't seem to have it. Strange since the 3.1 doc states this observer method is "Available in iPhone OS 3.0 and later".

To be sure. I checked my copy of iPhoneOS3.0.sdk/System/Library/Frameworks/StoreKit.framework/Headers/SKPaymentQueue.h to make sure the restore failure observer method is there. (It is.)

like image 52
otto Avatar answered Dec 27 '22 21:12

otto