我对 endMatchInTurnWithMatchData 的调用导致连接到服务中断错误。关于寻找什么来诊断此问题的任何提示?Xcode 7.3.1,部署目标 9.3
-(void)sendGameOver {
GKTurnBasedMatch *currentMatch = [[GameKitHelper sharedGameKitHelper] currentMatch];
// set the game outcome property for the current participant
GKTurnBasedMatchOutcome otherOutcome;
if (self.youAre == game.winningPlayer) {
[currentMatch.currentParticipant setMatchOutcome:GKTurnBasedMatchOutcomeWon];
otherOutcome = GKTurnBasedMatchOutcomeLost;
} else {
[currentMatch.currentParticipant setMatchOutcome:GKTurnBasedMatchOutcomeLost];
otherOutcome = GKTurnBasedMatchOutcomeWon;
}
// all other (only one other) participants get opposite outcome
for (GKTurnBasedParticipant *nextParticipant in currentMatch.participants) {
if (![nextParticipant isEqual:currentMatch.currentParticipant]) {
[nextParticipant setMatchOutcome:otherOutcome];
}
}
// prepare match data
NSDictionary *turn = [NSDictionary dictionaryWithObjects:@[game]
forKeys:@[gameKey]];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:turn];
NSArray *achievements = [self achievementsToReport:currentMatch];
NSArray *scores = [self scoresToReport:currentMatch];
[currentMatch endMatchInTurnWithMatchData:data scores:scores achievements:achievements completionHandler:^(NSError * _Nullable error) {
if (error) {
NSLog(@"%@", error);
[self setGamePopUpMessage:@"Oops, there was a problem. Try that again."];
}
}];
}