Search code examples
iosswiftxcodexcode4

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


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.


Solution

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