I am working on a multiplayer game and my match is started successfully. I have 3 players in my case. Player1, Player2, Player3. from Player3, I call disconnect method of GKMatch object and my disconnect method is
-(void)disocnnectOnlineMatch {
[self.currOnlineMatch disconnect];
self.currOnlineMatch.delegate = nil;
self.currOnlineMatch = nil;
}
on the Player1 and Player2 Devices this didChangeState function is called first time than after some times it is called again for the Player3 again. It is expected to be called one time only but its calling 2 times for both players
- (void)match:(GKMatch *)match player:(NSString *)playerID didChangeState:(GKPlayerConnectionState)state {
}
Any thing I am doing worng? what is the best practice to disconnect a match?
Also some times this is happening the didChangeState method is called but after a certain delay. While that some updates of disconnected player are required in game.
What could be the reason of delayed response?
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)match {
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
currOnlineMatch = match;
currOnlineMatch.delegate = self;
[PuzzleLogicManager sharedManager].onlineNextRound = 2;
[self setupRandomNumberToSend:2.0f];
[presentingViewController dismissViewControllerAnimated:YES completion:^() {
//NSLog(@"dismissed");
}];
}
Please help
thanks in advance