Search code examples
iphoneiosuistoryboardsegue

'Receiver (<ViewController:>) has no segue with identifier 'infoseg'


Recently my app is crashing when the app switch to the next ViewController.

this is the prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

    ShowInfoViewController *secondViewController = (ShowInfoViewController *)segue.destinationViewController;

this is how i call the method :

        [self performSegueWithIdentifier:@"infoseg" sender:self];

in the interface builder i have a segue with the same identifier as well.

any idea?

this is the log's Print :

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<ViewController: 0x1dda97d0>) has no segue with identifier 'infoseg''

*** First throw call stack: (0x322982a3 0x31a6a97f 0x34fdbca9 0x1972f 0x1a7fb 0x57d73 0x56ff3 0x5a2f3 0x372c2ef5 0x372029f1 0x3720290d 0x355115df 0x35510ccb 0x35539133 0x321de74d 0x35539593 0x3549d15d 0x3226d683 0x3226cee9 0x3226bcb7 0x321deebd 0x321ded49 0x32f472eb 0x34e24301 0x17427 0x173c8) libc++abi.dylib: terminate called throwing an exception


Solution

  • If your destination viewcontroller is inside a navigationcontroller, you might want to take a look at this question: How to set the delegate with a storyboard.

    Edit: from the error it looks like the segue you are trying to perform is not attached to the viewcontroller you are starting from. Try to remove the seque and drag it from the viewcontroller your code is in to the ShowInfoViewController inside interface builder.