-1

在我的游戏中,我需要检查其他玩家是否登录,如果他们登录了,那么我无法攻击他们。现在我通过在用户登录时设置一个布尔值,然后用 将其设置为 NO 来做到applicationDidEnterBackground这一点,但有人告诉我,这有时不会运行,尤其是在应用程序崩溃的情况下。

所以我的问题是,有没有其他方法可以确定玩家是否登录?

4

1 回答 1

2

applicationDidEnterBackground will generally be called. If you're worried about crashes you can implement an uncaught exception handler. You can also consider having a, relatively infrequent, keep alive update sent to the server periodically and auto-logout the user if it isn't received.

于 2013-07-14T22:02:22.220 回答