简体   繁体   English

GKMatchmakerViewController失败

[英]GKMatchmakerViewController failed

In my app, I can see data for Leaderboards and Achievements that I have created using iTunesConnect. 在我的应用程序中,我可以查看使用iTunesConnect创建的LeaderboardsAchievements数据。 I can use GKTurnBasedMatchmakerViewController with no problem. 我可以GKTurnBasedMatchmakerViewController使用GKTurnBasedMatchmakerViewController But if I use GKMatchmakerViewController , immediately after selected a friend to invite, the GKMatchmakerViewController comes back with a "failed" indication (see image). 但是,如果我使用GKMatchmakerViewController ,则在选择一个朋友邀请后, 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(已在AppStore上使用该ID)来进行测试,则GKMatchmakerViewController将在此应用程序上运行。

I have also tried to create new profile/bundle id, app id, etc. But the problem persists. 我也尝试创建新的配置文件/捆绑ID,应用ID等,但问题仍然存在。

Any suggestions? 有什么建议么?

Edit: Neither connectionWithPlayerFailed nor didFailWithError method was called when it failed. 编辑:当失败时, didFailWithError调用connectionWithPlayerFailed也不是didFailWithError方法。

Edit 2: 编辑2:

This messages showed up in device logs: 此消息显示在设备日志中:

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 无法启动名称为com.apple.GameCenterUI.GameCenterMatchmakerExtension.gsEvents的bootstrap_look_up端口:未知错误代码(1102)无法将com.apple.GameCenterUI.GameCenterMatchmakerExtension设置为键盘焦点

Edit 3: The "Play Now" (Auto-match) works fine. 编辑3:“立即播放”(自动匹配)工作正常。

在此处输入图片说明

Edit: code used 编辑:使用的代码

- (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. 在那之后,邀请应该工作。

Furthermore, in iOS9, there is no longer a sandbox. 此外,在iOS9中,不再有沙箱。 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. 您可以通过在发布模式而不是调试模式下运行来解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM