[英]GKMatchmakerViewController failed
在我的应用程序中,我可以查看使用iTunesConnect创建的Leaderboards
和Achievements
数据。 我可以GKTurnBasedMatchmakerViewController
使用GKTurnBasedMatchmakerViewController
。 但是,如果我使用GKMatchmakerViewController
,则在选择一个朋友邀请后, GKMatchmakerViewController
会立即返回“失败”指示(参见图片)。
这还不是全部。 如果我仅使用另一个捆绑软件ID(已在AppStore上使用该ID)来进行测试,则GKMatchmakerViewController将在此应用程序上运行。
我也尝试创建新的配置文件/捆绑ID,应用ID等,但问题仍然存在。
有什么建议么?
编辑:当失败时, didFailWithError
调用connectionWithPlayerFailed
也不是didFailWithError
方法。
编辑2:
此消息显示在设备日志中:
无法启动名称为com.apple.GameCenterUI.GameCenterMatchmakerExtension.gsEvents的bootstrap_look_up端口:未知错误代码(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!");
}
}
我以前看过 解决方法是通过游戏中心成为朋友。 在那之后,邀请应该工作。
此外,在iOS9中,不再有沙箱。 因此,如果您尝试使用应用程序的调试版本进行连接,则通知将打开游戏中心和应用程序商店,而不是直接转到您的应用程序。 您可以通过在发布模式而不是调试模式下运行来解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.