接收方(< ViewController:>)没有标识为'showAlerting'的标记 [英] Receiver (<ViewController:>) has no segue with identifier 'showAlerting''
本文介绍了接收方(< ViewController:>)没有标识为'showAlerting'的标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
segue运行,但应用程序因上述错误而崩溃.为什么会收到此no segue with identifier
消息?我定义了segue标识符.
The segue runs but the app crashes with the above error. Why do I get this no segue with identifier
message? I defined the segue Identifier.
这是viewDidAppear方法
Here is the viewDidAppear method
- (void)viewDidAppear:(BOOL)animated
{
[self performSegueWithIdentifier:@"showAlerting" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showAlerting"])
{
NSLog(@"Logging showAlerting");
}
}
我收到了这些日志消息
2015-03-28 20:04:33.025 xxxx[3684:741007] Logging showAlerting
2015-03-28 20:04:33.046 xxxx[3684:741007] xxxxxxxx,,
2015-03-28 20:04:33.111 xxxx[3684:741007] lat: xxx
2015-03-28 20:04:33.112 xxxx[3684:741007] lon: xxx
2015-03-28 20:04:33.798 xxxx[3684:741007] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<ViewController: 0x17d38930>) has no segue with identifier 'showAlerting''
*** First throw call stack:
(0x2c1a15a7 0x39d87c77 0x2f9830df 0xebde7 0x2f6bb37b 0x2f6bb837 0x2f9701bb 0x2fd00e89 0x2f9726ff 0x2f7b5baf 0x2f7b5a4f 0x2f7b5525 0x2f6d9201 0x2f6d9117 0x2f0d363b 0x276187 0x279e9d 0x2c167891 0x2c165fb1 0x2c0b2b51 0x2c0b2963 0x335f11a9 0x2f704c91 0xea5f5 0x3a330aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
推荐答案
问题是故事板中有两个同一个类的实例.一个带segue,一个不带segue.被隔离的控制器与您要隔离的控制器必须是不同的类.
The problem is that you have two instances of the same class in the storyboard; one with the segue, and one without. The controller that's being segued to needs to be a different class than the one you're segueing from.
这篇关于接收方(< ViewController:>)没有标识为'showAlerting'的标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文