【发布时间】: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