iOS应用程序在推送阶段崩溃,但仅在安装时崩溃

iOS应用程序在推送阶段崩溃,但仅在安装时崩溃,ios,uinavigationcontroller,segue,uistoryboardsegue,Ios,Uinavigationcontroller,Segue,Uistoryboardsegue,在第一次安装我的应用程序时,我尝试执行推送至segue。我嵌入了UINavigationController 但当我试图按下按钮转到第二个viewController时,应用程序崩溃,我出现以下错误: “由于未捕获的异常‘NSGenericeException’而终止应用程序,原因是:‘推送序列仅在源控制器由UINavigationController实例管理时才能使用。’” 但这只发生在第一次尝试、安装时。如果我不做任何更改并再次运行应用程序,segue会成功地将我发送到第二个视图控制器 你知

在第一次安装我的应用程序时,我尝试执行推送至segue。我嵌入了UINavigationController

但当我试图按下按钮转到第二个viewController时,应用程序崩溃,我出现以下错误:

“由于未捕获的异常‘NSGenericeException’而终止应用程序,原因是:‘推送序列仅在源控制器由UINavigationController实例管理时才能使用。’”

但这只发生在第一次尝试、安装时。如果我不做任何更改并再次运行应用程序,segue会成功地将我发送到第二个视图控制器

你知道发生了什么事吗?让我知道我需要提供更多的信息

编辑

我在开始时确实有UIPageViewController作为应用程序介绍屏幕

在AppDelegate.m中,我有

if(![[NSUserDefaults standardUserDefaults] boolForKey:@"hasSeenTutorial"]) {
UIPageControl *pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
pageControl.backgroundColor = [UIColor whiteColor];

UIStoryboard *storyBoard;
storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *walkthrough =
[storyBoard instantiateViewControllerWithIdentifier:@"IntroViewController"];
[self.window setRootViewController:walkthrough];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"hasSeenTutorial"];
}
return YES;
我在UIPageView上有一个按钮,它将用户发送到开始的ViewController

- (IBAction)ready:(id)sender {


UIStoryboard *storyBoard;
storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *viewController =
[storyBoard instantiateViewControllerWithIdentifier:@"ViewController"];
[self presentViewController:viewController animated:YES completion:nil];


}

如果有人遇到这个问题,在介绍屏幕之后,我将用户发送到NavigationViewController,而不是像这样发送到ViewController

- (IBAction)ready:(id)sender {


UIStoryboard *storyBoard;
storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *viewController =
[storyBoard instantiateViewControllerWithIdentifier:@"NavigationViewController"];
[self presentViewController:viewController animated:YES completion:nil];


}

这让赛格开始工作。感谢Martin H的提示。

您如何知道第一次安装和其他运行时的相同顺序和完全相同的情况?我在开始时加入了一个编辑,解释了这种情况错误消息准确地描述了问题:“推送序列只能在源控制器由UINavigationController实例管理时使用。“您有一个推送序列,但您没有将视图控制器推送到导航堆栈上。如果你在应用程序中没有导航控制器,也不打算有导航控制器,那么不要将segues的类型设置为“推送”。如果你的应用程序打算有一个导航控制器,但没有添加一个,然后将视图控制器推到上面。你的应用程序是否应该有导航控制器是另一个问题。我确实有导航控制器。在用户完成第一次安装时出现的介绍屏幕之后,我没有将用户发送到导航控制器。我将它们发送到ViewController。现在,在他们看了介绍屏幕后,我将它们发送到导航控制器,应用程序运行良好:)