问题
I am making a turnbased game using the gamecenter api. I wanted to make a one press button to rematch players so they don't have to go through the gamecenter view controllers and re invite the same player. In this question iOS Game Kit Turn Based Match Programatic Rematch the asker notes later on that ios 6.0 makes this really easy using rematchWithCompletionHandler. I have tried to use this in my game and have only gotten unkown selector errors or NSErrors saying that the match I am trying to create is not possible.
[currentMatch rematchWithCompletionHandler:^(GKTurnBasedMatch *match, NSError *error)
{
if (error) {
NSLog(@"%@", error);
}
else
{
currentMatch = match;
currentMatch.message = @"Rematch";
}
}];
Is there some stage that the match has to be in before calling rematch? or something I am missing?
回答1:
rematchWithCompletionHandler appears to only work when a match has been correctly ended by all players involved with the match.
回答2:
It only works for me when the two players are Game Center friends.
来源:https://stackoverflow.com/questions/13052638/trouble-using-the-new-rematchwithcompletionhandler-method-from-game-center