Search code examples
objective-ciosgamekitgksession

GKSession connectToPeer method doesn't time out


I'm struggling with a GKSession problem. I've got a client and server, and my client attempts a server connection with

[_gkSession connectToPeer:peerID withTimeout:10];

If the server explicitly rejects the connection with [_gkSession denyConnectionFromPeer:peerID] then the client's connectionWithPeerFailed:withError is triggered correctly.

However, if the server just ignores the connection or there's some other problem, the client will sit there trying to connect until the heat death of the universe. The timeout appears to have no effect whatsoever.

I can't see anything in the documentation that suggests setting up the timeout needs anything more than specifying the timeout interval - and all the client's other GKSession delegate methods are working fine. Am I missing something obvious here?


Solution

  • from my experience GKSession is VERY buggy. And I don't think apple is fixing these bugs. What I would do is start a timer when you try to connect to another party - if connection succeeds, cancel the timer, when it times out, cancel the connection. Regards!