如何知道用户何时触摸最后一个 StoreKit 警报“谢谢”的“确定”按钮。您购买成功了”?
我在游戏中集成了“应用内购买”,让用户解锁更多关卡。一切正常,但我对最后一个警报“谢谢。您的购买成功。[确定]”有一点问题。在弹出最后一个警报之前,我的程序被告知交易已成功完成,因此我的游戏再次开始运行 - 然后警报出现,烦扰了用户。我想等待我的游戏运行,直到用户触摸“确定”按钮,但由于这是来自 StoreKit 的警报,我不知道这种情况何时发生或如何捕获它。
我不想在警报下方创建另一个对话框(这次是我自己的,因此在我的控制之下),只是要求再次触摸“确定” - 将是一个糟糕的用户体验。
有人有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有同样的问题。我发现每当用户触摸“谢谢”消息的“确定”时,就会调用
applicationDidBecomeActive:(UIApplication *)application
,所以也许这可能是一种方法。我想知道是否有人有更好的方法。
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)将该 storekit 警报设置为 delegate = yourclass。
2) 使用 UIAlertViewDelegate 声明您的类,然后使用此方法拦截警报:
您可以检查警报标题/消息以查看它是否是正确的警报:
1) set that storekit alert as delegate = yourclass.
2) Declare yourclass with the UIAlertViewDelegate, then use this method to intercept the alert:
You can check the alert title/message to see if it's the correct alert:
我认为艾琳走在正确的道路上。我也遇到了同样的问题,并在“Interwebs”上搜索以找到答案,但似乎没有。
出于游戏的目的,我建议暂停和恢复游戏以响应您的
applicationDidBecomeActive:
和applicationWillResignActive:
UIApplicationDelegate 方法。这不仅会导致游戏暂停,直到用户取消成功购买警报为止,还会在收到短信、接到电话或任何其他导致应用程序中断的事件时暂停游戏。虽然在这种情况下很烦人,但添加游戏的自动暂停和恢复将添加一个非常用户友好的功能,您的用户会欣赏的。
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:
andapplicationWillResignActive:
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.