我该如何使用GameKit实现和测试一个多人(回合制)游戏?这里有一些问题我需要解决:
- 沙盒中没有其他匹配,所以我没有从匹配查找器得到任何回调。 - Xcode只允许运行一个模拟器实例,那么我怎么连接两个客户端?
对于测试基于GameKit的多人游戏,一些建议会很不错。
编辑:
我已经在设备上运行了应用程序的实例,另一个在模拟器上运行,但我仍然找不到匹配。
- 沙盒中没有其他匹配,所以我没有从匹配查找器得到任何回调。 - Xcode只允许运行一个模拟器实例,那么我怎么连接两个客户端?
对于测试基于GameKit的多人游戏,一些建议会很不错。
编辑:
我已经在设备上运行了应用程序的实例,另一个在模拟器上运行,但我仍然找不到匹配。
// I call this code on both clients after authentication is successful
GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.minPlayers = 2;
request.maxPlayers = 2;
[[GKMatchmaker sharedMatchmaker] findMatchForRequest:request withCompletionHandler:^(GKMatch *match, NSError *error) {
if (error)
{
// Process the error.
NSLog(@"error");
}
else if (match != nil)
{
self.myMatch = match;
match.delegate = self;
if (!self.matchStarted && match.expectedPlayerCount == 0)
{
self.matchStarted = YES;
}
}
}];