Ios 尝试在ViewController上呈现GameViewController,该控制器正在等待GKTurnBasedMatchmakerViewController的延迟呈现完成

Ios 尝试在ViewController上呈现GameViewController,该控制器正在等待GKTurnBasedMatchmakerViewController的延迟呈现完成,ios,objective-c,xcode,game-center,modalviewcontroller,Ios,Objective C,Xcode,Game Center,Modalviewcontroller,每次运行应用程序时,我都会在调试日志中看到该错误。我点击Find Game(查找游戏),它会将我带到主屏幕,键盘因此错误而无法工作,当我点击back(后退)按钮时,视图控制器会因此错误再次弹出。我不知道如何修复它,因此非常感谢您的帮助。谢谢 // A peer-to-peer match has been found, the game should start - (void)turnBasedMatchmakerViewController: (GKTurnBasedMatchmakerVi

每次运行应用程序时,我都会在调试日志中看到该错误。我点击Find Game(查找游戏),它会将我带到主屏幕,键盘因此错误而无法工作,当我点击back(后退)按钮时,视图控制器会因此错误再次弹出。我不知道如何修复它,因此非常感谢您的帮助。谢谢

// 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];

GameKit文档指出,您的didFindMatch方法应该关闭视图控制器,并对匹配对象执行所需的操作

您的方法应该如下所示

- (void)turnBasedMatchmakerViewController: (GKTurnBasedMatchmakerViewController *)viewController didFindMatch:(GKTurnBasedMatch *)match {
    // Dismiss the view controller
    [viewController dismissViewControllerAnimated:YES completion:nil];
    // Perform your logic
}
发件人:

游戏应关闭视图控制器并使用匹配对象 向玩家显示比赛的当前状态

还是一样的问题关闭视图控制器[视图控制器关闭视图控制器激活:是完成:无];//在此处显示下一个控制器[显示IEWController performsguewithidentifier:@gameplaysecene sender:match];你的presentingViewController是什么?@interface GameKitHelper:NSObject{UIViewController*presentingViewController;}-Break--VoidFindMatch with MinPlayer:IntMinPlayer MaxPlayer:IntMaxPlayer viewController:UIViewController*viewController{presentingViewController=viewController;-Break//这行代码打断游戏屏幕上的后退按钮[presentingViewController presentViewController:mmvc animated:YES completion:nil];}我的实际视图控制器都不是presentingViewController。