self.performSegue cannot find storyboard-segue-ID even though it has been named

508 Views Asked by At

I am trying to programmatically segue in LiveController.swift. The relevant bit of code is here in LiveController.swift

self.performSegue(withIdentifier:"openWelcomePage" ,sender:self)

which throws error:

2020-04-16 20:51:44.614413-0400 alpha[53206:2805423] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<alpha.LiveController: 0x101c248c0>) has no segue with identifier 'openWelcomePage''

This indicates the segue has not been named. But it has:

enter image description here

The over all storyboard is here:enter image description here

Note the highlighted NavigationController is the source, it embeds Live which is attached to LiveController.swift. The target of the segue is the page with Log in and Sign up.

Note when I put a button into LiveController and drag a segue from the button to the Welcome view, and name it buttonSegue:

 self.performSegue(withIdentifier:"buttonSegue" ,sender:self)

displays the page modally as expected.

2

There are 2 best solutions below

2
aiwiguna On BEST ANSWER

You need to have the segue from LiveController, not from Navigation Controller

7
Miguel Tepale On

This could be a few things so try these fixes:

  1. Clean and build your project. Then, run again.
  2. Quit Xcode, open up project and run.
  3. In the Attribute Inspector, remove openWelcomePage and leave it blank.

Hope that either of these suggestions help.