开发者

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 aler开发者_如何转开发t 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?


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..


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
}


I think Irene in on the right path. I had this same problem and scoured the "Interwebs" to find an answer, and it seems that there is none.

For the purposes of your game, I would recommend pausing and resuming the game in response to your applicationDidBecomeActive: and applicationWillResignActive: UIApplicationDelegate methods. Not only will this cause the game to be paused until the user dismisses the successful purchase alert, it will also pause the game when a text message is received, a phone call is received, or any other event causes the application to be interrupted.

While annoying in this case, adding automatic pausing and resuming of your game will add a very user-friendly feature that your users will appreciate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜