Game center takes forever to show disconnected
When game center has a match running and one player disconnects it takes at least 30 seconds for the disconnect method to get called. Any ideas on how to make the disconnect method called as soon as the opponent quits the applications.
(void)match:(GKMatch *)theMatch player:(NSString *)playerID didChangeState:(GKPlayerConnectionState)state {
if (开发者_开发百科match != theMatch) return;
switch (state) {
case GKPlayerStateConnected:
// handle a new player connection.
NSLog(@"Player connected!");
if (!matchStarted && theMatch.expectedPlayerCount == 0) {
NSLog(@"Ready to start match!");
[self lookupPlayers];
}
break;
case GKPlayerStateDisconnected:
// a player just disconnected.
NSLog(@"Player disconnected!");
matchStarted = NO;
[delegate matchEnded];
break;
}
}
I am not sure but i have one suggestion for you ...
if you are using threading than quit the thread forcefully ...
and check this links for know more about threading...
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/CreatingThreads/CreatingThreads.html
And check the how to Terminating a Thread.
精彩评论