6

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

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"

- (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.

Any help with this is greatly appreciated.

EliteTech
  • 386
  • 3
  • 13

5 Answers5

10

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.

EliteTech
  • 386
  • 3
  • 13
  • I've just had this problem with a physical device and found that simply uninstalling the app and then running it from Xcode again solved this problem. – arik Nov 23 '13 at 13:03
  • Out of curiosity what version of xcode were you running? I was running 4.5 at the time of my original post. – EliteTech Nov 24 '13 at 18:39
  • 1
    I was running the latest non-beta version of Xcode 5, build 5A3005. – arik Nov 24 '13 at 18:57
  • Hopefully this helps someone. I had the same problem and what had happened was that I had copy and pasted the controller I was connecting segues to. The actual controller was underneath it and actually didn't have segues.So I had 2 controllers in the storyboard for the same class right on top of each other. – ribeto Jan 28 '14 at 14:56
  • I changed simulator device type and also cleaned the project but the error is still there; the error only disappears after I delete the App inside simulator and re-run. – Yingpei Zeng May 25 '14 at 13:53
  • The same bug happens in XCode 7.3. Switching devices caused whatever stale cache it had to be updated and then it works. – geis May 21 '16 at 22:28
1

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.

Community
  • 1
  • 1
Benjohn
  • 13,228
  • 9
  • 65
  • 127
0

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.

JimC
  • 1
0

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.

fir
  • 387
  • 1
  • 3
  • 19
0

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!

user3749398
  • 81
  • 1
  • 5