开发者

GKSession: not visible after suspending the App

I am working around for a while with GameKit. Almost everything works fine. I have a major Problem with the session:peer:didChangeState: Method not beeing called after resuming.

In the Apple example GKRocket the session is destroyed if the app suspends(willTerminate) and setup when it comes back(willResume). For my app it would be nice to keep the session up.

In the Logs i can see, that session:peer:didChangeState: with state GKPeerStateUnavailable is called when the app suspends, but after resuming the call with GKPeerStateAvailable doesnt show up. The session is available. But even new clients cant find the device.

I use the SessionModes Server/Client.

Thanks in advance for your h开发者_运维技巧elp!


I was playing with sessions some time ago, but have some suggestions...

-after resuming, what happens if you try to send packed from device which was sleeping to device which was awake? does it go through ?

-do you need GKPeerStateUnavailable / available ? From my experience all you need to use are applicationDidBecomeActive and applicationWillResignActive methods: when going to sleep you send GAME_PAUSED to other device, when awake - GAME_UNPAUSED. If user puts app to sleep and then closes it - well, bad luck, the other player will sit there forever (so you can give him an option to quit to main menu). This approach works with apple (in terms of approval) - tested on two apps. Regards!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜