当然,我在提交之前进行了测试,它在 iOS 6 上的模拟器上工作,但在 5.1 上它不会工作,因为 expectedPlayerCount 总是出现 1 而不是 0 !就在5.1!!我搜索了这个问题,开发人员说它的网络问题和沙盒问题,所以我提交了我的应用程序并获得了批准!现在我试了一下,它总是卡在连接上!!!
(void)findMatchWithMinPlayers:(int)minPlayers maxPlayers:(int)maxPlayers viewController:(UIViewController *)viewController delegate:(id)theDelegate {
如果(!gameCenterAvailable)返回;
比赛开始=否;self.match = nil; self.presentingViewController = viewController; 委托=委托;
if (pendingInvite != nil) {
[presentingViewController dismissModalViewControllerAnimated:NO]; NSLog(@"findmatch"); GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc] initWithInvite:pendingInvite] ; mmvc.matchmakerDelegate = self; [presentingViewController presentModalViewController:mmvc animated:YES]; self.pendingInvite = nil; self.pendingPlayersToInvite = nil;
} 别的 {
[presentingViewController dismissModalViewControllerAnimated:NO]; NSLog(@"findmatch2"); GKMatchRequest *request = [[GKMatchRequest alloc] init] ; request.minPlayers = minPlayers; request.maxPlayers = maxPlayers; request.playersToInvite = pendingPlayersToInvite; GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc] initWithMatchRequest:request]; mmvc.matchmakerDelegate = self; [presentingViewController presentModalViewController:mmvc animated:YES]; self.pendingInvite = nil; self.pendingPlayersToInvite = nil;
}
}
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)theMatch { NSLog(@"%d",theMatch.expectedPlayerCount); [presentingViewControllerdismissModalViewControllerAnimated:YES]; NSLog(@"didfind"); self.match = theMatch; NSLog(@"%d",match.expectedPlayerCount); match.delegate = 自我;if (!matchStarted && match.expectedPlayerCount == 0) { NSLog(@"准备开始比赛!"); [自我查找玩家]; } }
请帮助我得到这么多不好的评论!