0

当然,我在提交之前进行了测试,它在 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(@"准备开始比赛!"); [自我查找玩家]; } }

请帮助我得到这么多不好的评论!

4

1 回答 1

0

现在可能为时已晚,但您确定在 iTunes Connect 的两个地方都启用了 Game Center 吗?这篇文章:https ://devforums.apple.com/thread/66773?tstart=0

告诉您在“管理游戏中心”部分和要上传的版本中启用(否则它可能在沙盒中有效,但在应用商店中无效)

希望能帮助到你!

于 2013-03-27T18:51:49.277 回答