xcode 接收器没有标识符 execption 的 segue

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18318224/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:43:05  来源:igfitidea点击:

Receiver has no segue with identifier execption

iosxcodestoryboard

提问by EliteTech

I have this weird problem, for some reason my segue is not working correctly.

我有这个奇怪的问题,由于某种原因,我的 segue 无法正常工作。

I have two segues setup, depending on the status of one setting determine the segue it choses. One of them works like a charm while the other gets "Receiver has no segue with identifier"

我有两个 segue 设置,根据一个设置的状态确定它选择的 segue。其中一个像魅力一样工作,而另一个得到“接收者没有标识符的segue”

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

// check if registered already
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"registered"] == YES) {
    // Registered

    // Give the logo some time to show before moving on
    [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(splashLoadedRegistered:) userInfo:nil repeats:NO];
} else {
    // Register

    // Give the logo some time to show before moving on
    [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(splashLoaded:) userInfo:nil repeats:NO];
}
}



-(void)splashLoaded:(id)sender
{
//This one works
[self performSegueWithIdentifier:@"registerSegue" sender:self];
}

-(void)splashLoadedRegistered:(id)sender
{
//This one does not work
[self performSegueWithIdentifier:@"registeredSegue" sender:self];
}

Here is a screen shot of my storyboard.

这是我的故事板的屏幕截图。

Screenshot

截屏

Things to note:

注意事项:

  1. I have checked the spelling of the segue.

  2. This is the only storyboard in the app, and I have checked to make sure this was the one setup in the info.plist, and in the summary of the project.

  3. I have reset the simulator, and cleaned the project.

  4. The segue is coming from the ViewController, not the View.

  1. 我检查了 segue 的拼写。

  2. 这是应用程序中唯一的故事板,我已经检查以确保这是 info.plist 和项目摘要中的一个设置。

  3. 我已经重置了模拟器,并清理了项目。

  4. segue 来自 ViewController,而不是 View。

Any help with this is greatly appreciated.

非常感谢您对此的任何帮助。

回答by EliteTech

There was no Answer to my question. The problem seems to be a simple bug in xcode. After changing the device in the simulator the segue work fine. It even worked after changing it back to the device type that had the problem.

我的问题没有答案。问题似乎是 xcode 中的一个简单错误。在模拟器中更改设备后,segue 工作正常。它甚至在将其改回有问题的设备类型后也能工作。

回答by Benjohn

Based on the original poster's own answer, I reset the Simulator's "Content and Settings". This resolved the issue.

根据原始海报自己的回答,我重置了模拟器的“内容和设置”。这解决了问题。

I understand xCode optimises copying the app's bundle on to the device, only copying things that change. I would guess that something had gone wrong with this and it wasn't copying changes to the effected storyboard.

我知道 xCode 优化了将应用程序的捆绑包复制到设备上,只复制更改的内容。我猜这有什么问题,它没有将更改复制到受影响的故事板。

回答by JimC

I found that if you open the story board file in the source editor you will see that the segues is placed in the wrong section, it should be in the connection section of the view controller. Xcode 5 sometimes puts the segues in the wrong place in the XML tree. Edit the tree by hand.

我发现如果你在源代码编辑器中打开故事板文件,你会看到 segues 放在错误的部分,它应该在视图控制器的连接部分。Xcode 5 有时会将 segue 放在 XML 树中的错误位置。手动编辑树。

回答by fir

Try to rename your segue both in StoryBoard and in manual performing in ViewController. Sometimes its happen when you delete previous segue with the same name. Or you created two segues with the same name and deleted then one of them.

尝试在 StoryBoard 和在 ViewController 中手动执行重命名您的 segue。有时,当您删除以前同名的 segue 时会发生这种情况。或者您创建了两个同名的 segue,然后删除了其中一个。

回答by user3749398

For me, I had to make sure that my segue was going the correct way. Make sure that all of your arrows in the storyboard editor are flowing the correct way!

对我来说,我必须确保我的转场以正确的方式进行。确保故事板编辑器中的所有箭头都以正确的方式流动!