November 2011
Beginner
238 pages
6h 19m
English
A player can quit a match at any time by swiping across it from the matchmaker view controller. However, you might want to add a path for your users to forfeit or quit a match from inside of your game itself. To allow a player to forfeit a match, use the following code snippet.
- (IBAction)forfeit:(id)sender
{
[self.match participantQuitOutOfTurnWithOutcome:GKTurnBasedMatchOutcomeQuit
withCompletionHandler:^(NSError *error) {
if (error) {
NSLog(@"An error occurred ending match: %@", [error localizedDescription]);
}
}];
}