我正在摆弄使用Game Center进行简单的多人游戏。我正在使用Apple的代码。我只是将最大玩家数量改为5而不是2:
- (void)hostMatch:(id)sender
{
GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.minPlayers = 2;
request.maxPlayers = 5;
GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc] initWithMatchRequest:request];
mmvc.matchmakerDelegate = self;
[self presentViewController:mmvc animated:YES completion:nil];
}
当request.maxPlayers
等于2-4时,它可以正常工作,但是一旦我超过5,它就会给我这个错误:
The requested operation could not be completed because the match request is invalid.
有没有人想出解决方案?
答案 0 :(得分:3)
这一切都取决于您正在创建的游戏类型。下表来自apple doc's:
表7-3
每种比赛的最大球员数
匹配类型。最大玩家数
Peer-to-Peer 4
托管。 16
打开为主。 16