GKMatchmakerViewController 失败 [英] GKMatchmakerViewController failed
问题描述
在我的应用中,我可以看到我使用 iTunesConnect 创建的 Leaderboards
和 Achievements
的数据.我可以毫无问题地使用 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).
这还不是全部.如果我使用另一个 bundle id(一个已经在 AppStore 上的)只是为了测试,那么 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.
有什么建议吗?
connectionWithPlayerFailed
和 didFailWithError
方法在失败时都没有被调用.
Neither connectionWithPlayerFailed
nor didFailWithError
method was called when it failed.
编辑 2:
此消息显示在设备日志中:
This messages showed up in device logs:
无法使用名称 bootstrap_look_up 端口com.apple.GameCenterUI.GameCenterMatchmakerExtension.gsEvents:未知错误代码 (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
编辑 3:立即播放"(自动匹配)工作正常.
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屋!