我使用的是标准匹配用户界面和两台 iPad iOS6。问题是当我在第一台设备中创建新的匹配项时,第二台设备应该在我查看匹配用户界面时看到现有的匹配项,但事实并非如此。我确定我的代码是正确的。这是方法:
-(void)findMatchWithMinPlayers:(int)minPlayers maxPlayers:(int)maxPlayers viewController:(UIViewController*)viewController {
// the view that will present Matchmaker View Controller
self.viewCaller = viewController;
GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.minPlayers = minPlayers;
request.maxPlayers = maxPlayers;
GKTurnBasedMatchmakerViewController *viewMatchmaker = [[GKTurnBasedMatchmakerViewController alloc] initWithMatchRequest:request];
viewMatchmaker.turnBasedMatchmakerDelegate = self;
viewMatchmaker.showExistingMatches = YES;
[self.viewCaller presentViewController:viewMatchmaker animated:YES completion:nil];
}
我什至尝试了两个不同的示例游戏,但出现了同样的问题,那么我该如何解决呢?
最佳答案
当 Gamekit 为回合制比赛做媒人时,它会尝试找到一个有空位的比赛来填充玩家。如果它找不到空位来填充玩家,则会创建一个新的比赛。
尝试在一台设备上创建匹配项并使用该设备完成一个回合,即当您调用...
endTurnWithNextParticipants:turnTimeout:matchData:completionHandler:
然后在另一台设备上尝试寻找匹配项。
关于game-center - Game Center 回合制自动匹配不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13420757/