【问题标题】:GKMatchmakerViewController failedGKMatchmakerViewController 失败
【发布时间】:2016-02-27 09:44:36
【问题描述】:

在我的应用程序中,我可以看到使用 iTunesConnect 创建的 Leaderboards 和 Achievements 的数据。我可以毫无问题地使用GKTurnBasedMatchmakerViewController。但如果我使用GKMatchmakerViewController,在选择要邀请的朋友后,GKMatchmakerViewController 会立即返回“失败”指示(见图)。

这还不是全部。如果我使用另一个捆绑 ID(AppStore 上已有的)只是为了测试,那么 GKMatchmakerViewController 将在这个应用上工作。

我也尝试创建新的配置文件/捆绑包 ID、应用 ID 等。但问题仍然存在。

有什么建议吗?

编辑:connectionWithPlayerFailed 和 didFailWithError 方法在失败时都没有被调用。

编辑 2:

此消息显示在设备日志中:

无法使用名称引导_look_up 端口 com.apple.GameCenterUI.GameCenterMatchmakerExtension.gsEvents:未知 错误代码 (1102) 设置失败 com.apple.GameCenterUI.GameCenterMatchmakerExtension 作为键盘焦点

编辑 3:“立即播放”(自动匹配)工作正常。

编辑:使用的代码

- (void)findMatchWithMinPlayers:(int)minPlayers maxPlayers:(int)maxPlayers
                 viewController:(UIViewController *)viewController
                       delegate:(id<GameKitHelperDelegate>)delegate {

    if (!_enableGameCenter) return;
    MyNSLogSys;
    _matchStarted = NO;
    self.match = nil;
    _delegate = delegate;
//    [viewController dismissViewControllerAnimated:NO completion:nil];
    GKMatchRequest *request = [[GKMatchRequest alloc] init];
    request.minPlayers = minPlayers;
    request.maxPlayers = maxPlayers;

    GKMatchmakerViewController *mmvc =
    [[GKMatchmakerViewController alloc] initWithMatchRequest:request];
    mmvc.matchmakerDelegate = self;

    [viewController presentViewController:mmvc animated:YES completion:nil];

}

// The user has cancelled matchmaking
- (void)matchmakerViewControllerWasCancelled:(GKMatchmakerViewController *)viewController {
    [viewController dismissViewControllerAnimated:YES completion:nil];
}

// Matchmaking has failed with an error
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFailWithError:(NSError *)error {
    [viewController dismissViewControllerAnimated:YES completion:nil];
    NSLog(@"Error finding match: %@", error.localizedDescription);
}

// A peer-to-peer match has been found, the game should start
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)match {
    [viewController dismissViewControllerAnimated:YES completion:nil];
    self.match = match;
    match.delegate = self;
    if (!_matchStarted && match.expectedPlayerCount == 0) {
        NSLog(@"Ready to start match!");
    }
}

【问题讨论】:

  • 请显示您启动 matchmaker 的代码并检查错误
  • @Thunk:添加代码。

标签: ios app-store-connect game-center


【解决方案1】:

我以前见过这个。绕过它的方法是通过游戏中心成为朋友。在那之后,邀请应该工作。

此外,在 iOS9 中,不再有沙盒。因此,如果您尝试使用应用程序的调试版本进行连接,通知将打开游戏中心和应用程序商店,而不是直接转到您的应用程序。您只需在发布模式而不是调试模式下运行即可解决此问题。

【讨论】:

  • 涉及的两名玩家已经是朋友了。由于这是为了邀请,所以还没有涉及到通知。我也尝试将应用程序作为发布模式运行。如我的帖子所述,来自 GC 应用或直接来自我的应用的邀请均失败。
  • 我遇到了这个问题,只能通过使用不同的播放器来解决它。似乎这两个玩家标记了一些东西,使它总是通过游戏中心失败。您也可以邀请您最近玩过的人进行测试。首先播放“立即播放”,然后进入邀请,您应该会在“最近”标签下看到该用户。
  • 现在似乎工作正常。他们最近可能已经解决了这个问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-20
  • 2016-01-22
  • 1970-01-01
  • 2013-02-24
  • 2011-01-17
  • 1970-01-01
相关资源
最近更新 更多