Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know when the user touches the OK button of the last StoreKit alert "Thank you. Your purchase was successful"?

I have integrated "In App Purchase" in a game to let the user unlock more levels. Everything works fine, but I have a little problem with the last alert "Thank You. Your purchase was successful. [OK]". My program gets informed that the transaction was successfully completed before this last alert pops up and so my game starts running again - then the alert comes up, annoying the user. I would like to wait with my game running until the user touches the "OK" button, but since it is an alert from StoreKit I have no idea when this happens or how I could catch it.

I don't want to create another dialog (this time my own, therefor under my control) below the alert, just asking for touching "OK" again - would be a bad user experience.

Anybody have any ideas?

like image 728
Walchy Avatar asked Apr 04 '10 20:04

Walchy


2 Answers

1) set that storekit alert as delegate = yourclass.

2) Declare yourclass with the UIAlertViewDelegate, then use this method to intercept the alert:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

You can check the alert title/message to see if it's the correct alert:

if ([alertView.message isEqualToString:@"Thank you.. bla bla bla"]) {
    //something
}
like image 33
Nicholas Valbusa Avatar answered Sep 28 '22 01:09

Nicholas Valbusa


I'm having the same question. I found that whenever the user touches "OK" to that "Thank you" message, applicationDidBecomeActive:(UIApplication *)application is called, so maybe this could be a way. I'd like to know if someone has a better way though..

like image 188
phi Avatar answered Sep 28 '22 02:09

phi