Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 游戏中心配对后,我的应用程序将切换到默认游戏视图,而不是当前加入的游戏_Ios_Segue_Game Center - Fatal编程技术网

Ios 游戏中心配对后,我的应用程序将切换到默认游戏视图,而不是当前加入的游戏

Ios 游戏中心配对后,我的应用程序将切换到默认游戏视图,而不是当前加入的游戏,ios,segue,game-center,Ios,Segue,Game Center,我能够按下“查找游戏”按钮,游戏中心配对成功。我已将segue设置为Modal。找到匹配项后,我希望它在另一个视图控制器(GamePlaySecene)中转换到该匹配项。现在它正在这样做,但有点错误。它不会将用户带到他们刚刚加入的当前游戏,而是显示没有交互的游戏布局,而不是刚刚加入的实际游戏 // viewcontroller.m (Main Menu) - (IBAction)findGame:(UIButton *)sender { [[GameKitHelper sharedInsta

我能够按下“查找游戏”按钮,游戏中心配对成功。我已将segue设置为Modal。找到匹配项后,我希望它在另一个视图控制器(GamePlaySecene)中转换到该匹配项。现在它正在这样做,但有点错误。它不会将用户带到他们刚刚加入的当前游戏,而是显示没有交互的游戏布局,而不是刚刚加入的实际游戏

// viewcontroller.m (Main Menu)

- (IBAction)findGame:(UIButton *)sender {

[[GameKitHelper sharedInstance]
 findMatchWithMinPlayers:2 maxPlayers:2 viewController:self]; // Start matchmaking when pressing the find game button
}
  - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"GamePlayScene"])
    {
        GameViewController *c = (GameViewController*)segue.destinationViewController;
        c.match = [GameKitHelper sharedInstance].currentMatch;
    }
}

// GameKitHelper.m

- (void)turnBasedMatchmakerViewController:(GKTurnBasedMatchmakerViewController *)viewController didFindMatch:(GKTurnBasedMatch *)match
{
    [presentingViewController dismissViewControllerAnimated:YES completion:nil];
    [presentingViewController performSegueWithIdentifier:@"GamePlayScene" sender:match];

    self.currentMatch = match;

您的GameViewController可能只是在演示时创建了一个新场景。把密码贴出来。如果(skView.scene==nil{/*create&present scene here*/}搜索了我的项目,没有结果,则应该使用
保护它。