最近,当应用程序切换到下一个 ViewController 时,我的应用程序崩溃了。
这是prepareForSegue:(UIStoryboardSegue *)segue 发送者:(id)sender
ShowInfoViewController *secondViewController = (ShowInfoViewController *)segue.destinationViewController;
这就是我调用该方法的方式:
[self performSegueWithIdentifier:@"infoseg" sender:self];
在界面生成器中,我也有一个具有相同标识符的segue。
有什么想法吗?
这是日志的打印:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<ViewController: 0x1dda97d0>) has no segue with identifier 'infoseg''
*** 第一个抛出调用堆栈: (0x322982a3 0x31a6a97f 0x34fdbca9 0x1972f 0x1a7fb 0x57d73 0x56ff3 0x5a2f3 0x372c2ef5 0x372029f1 0x3720290d 0x355115df 0x35510ccb 0x35539133 0x321de74d 0x35539593 0x3549d15d 0x3226d683 0x3226cee9 0x3226bcb7 0x321deebd 0x321ded49 0x32f472eb 0x34e24301 0x17427 0x17 3c8) libc++abi.dylib:终止调用并抛出异常
最佳答案
如果您的目标 View Controller 位于导航 Controller 内,您可能想看看这个问题:How to set the delegate with a storyboard .
编辑:从错误看来,您尝试执行的转场并未附加到您开始的 View Controller 。尝试删除序列并将其从代码所在的 View Controller 拖动到界面构建器内的 ShowInfoViewController 中。
关于iphone - '接收器(<ViewController :>) has no segue with identifier 'infoseg' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12996504/