GKMatchmakerViewController失败 [英] GKMatchmakerViewController failed

查看:114
本文介绍了GKMatchmakerViewController失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my app, I can see data for Leaderboards and Achievements that I have created using iTunesConnect. I can use GKTurnBasedMatchmakerViewController with no problem. But if I use GKMatchmakerViewController, immediately after selected a friend to invite, the GKMatchmakerViewController comes back with a "failed" indication (see image).

那还不是全部.如果我仅使用另一个捆绑软件ID(已在AppStore上使用该ID)来进行测试,则GKMatchmakerViewController将在此应用程序上运行.

That was not all. If I use another bundle id (one that already on AppStore) just to test, then GKMatchmakerViewController will work on this app.

我还尝试创建新的配置文件/捆绑ID,应用ID等,但问题仍然存在.

I have also tried to create new profile/bundle id, app id, etc. But the problem persists.

有什么建议吗?

connectionWithPlayerFaileddidFailWithError方法失败均不会被调用.

Neither connectionWithPlayerFailed nor didFailWithError method was called when it failed.

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

This messages showed up in device logs:

无法使用名称启动bootstrap_look_up端口 com.apple.GameCenterUI.GameCenterMatchmakerExtension.gs事件:未知 错误代码(1102)设置失败 com.apple.GameCenterUI.GameCenterMatchmakerExtension作为键盘焦点

Unable to bootstrap_look_up port with name com.apple.GameCenterUI.GameCenterMatchmakerExtension.gsEvents: unknown error code (1102) Failed to set com.apple.GameCenterUI.GameCenterMatchmakerExtension as keyboard focus

立即播放"(自动匹配)工作正常.

Edit 3: The "Play Now" (Auto-match) works fine.

使用的代码

- (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!");
    }
}

推荐答案

我以前见过.解决方法是通过游戏中心成为朋友.在那之后,邀请应该工作.

I have seen this before. The way around it is to become friends through the game center. After that, the invites should work.

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

Furthermore, in iOS9, there is no longer a sandbox. So, if you are trying to connect using a debug version of your app, the notification will open game center and app store rather than going directly to your app. You can get around this simply by running in release mode instead of debug mode.

这篇关于GKMatchmakerViewController失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆