Let’s say there is a GKTurnBasedMatch with only 2 participants left that haven’t quit yet.
If the current participant wants to quit, instead of calling, participantQuitInTurnWithOutcome:... is it correct to call, endMatchInTurnWithMatchData:... since the match can’t continue with only one participant?
But if the other participant wants to quit, you can’t call endMatchInTurnWithMatchData:... since it is not your turn, so you would have to call participantQuitOutOfTurnWithOutcome:... but then you are left with a single participant in the match.
What is the correct way to handle these situations?
you can call
–participantQuitOutOfTurnWithOutcome:withCompletionHandler:then-(void)handleTurnEventForMatch:(GKTurnBasedMatch *)match didBecomeActive:(BOOL)didBecomeActivefromGKTurnBasedEventHandlerDelegatewill be called for all other participants.There you can call
-(void)endMatchInTurnWithMatchData:(NSData *)matchData completionHandler:(void (^)(NSError *error))completionHandlerfor player whose turn is now.To determine, who left your match, check GKTurnBasedParticipant’s property matchOutcome – it will be GKTurnBasedMatchOutcomeQuit.