每次运行我的应用程序时,我都会在调试日志中收到错误。我单击查找游戏,它将我带到主屏幕,由于此错误键盘不起作用,当我点击后退按钮时,视图控制器它只是弹回(再次由于此错误)。我无法弄清楚如何解决它,所以任何帮助将不胜感激。感谢。
// A peer-to-peer match has been found, the game should start
- (void)turnBasedMatchmakerViewController: (GKTurnBasedMatchmakerViewController *)viewController didFindMatch:(GKTurnBasedMatch *)match
{
// Display default view [presentingViewController dismissViewControllerAnimated:YES completion:nil];
[presentingViewController dismissViewControllerAnimated:YES completion:^{
// Present next controller here
[presentingViewController performSegueWithIdentifier:@"GamePlayScene" sender:match];
}];
// Removing line below fixes Warning: Attempt to dismiss from view controller <GameNavigationController: 0x78f4f820> while a presentation or dismiss is in progress!
// [self dismissModalViewController];
答案 0 :(得分:0)
GameKit文档指出你的didFindMatch方法应该关闭视图控制器并对匹配对象执行所需的操作。
你的方法应该是这样的。
- (void)turnBasedMatchmakerViewController: (GKTurnBasedMatchmakerViewController *)viewController didFindMatch:(GKTurnBasedMatch *)match {
// Dismiss the view controller
[viewController dismissViewControllerAnimated:YES completion:nil];
// Perform your logic
}
您的游戏应该关闭视图控制器并使用匹配对象 向玩家显示比赛的当前状态。