我可以在GameCenter游戏中拥有超过4名玩家吗?

时间:2013-12-09 05:37:34

标签: ios iphone ios7 game-center

我正在摆弄使用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.

有没有人想出解决方案?

1 个答案:

答案 0 :(得分:3)

这一切都取决于您正在创建的游戏类型。下表来自apple doc's:

  

表7-3

     

每种比赛的最大球员数

     

匹配类型。最大玩家数

     

Peer-to-Peer 4

     

托管。 16

     

打开为主。 16

以下是进一步研究的链接:https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/MatchmakingwithGameCenter/MatchmakingwithGameCenter.html#//apple_ref/doc/uid/TP40008304-CH12-SW7