1
votes

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'MySegue''

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController *viewController;
switch (indexPath.row) {
    case AUDIO:

        [self performSegueWithIdentifier:@"MySegue" sender:self];
        break;
    case PDF:
        viewController = [[[PDFExampleViewController alloc] init]autorelease];

        break;
    case PROCEDURAL:
        viewController = [[[ProceduralExampleViewController alloc] init] autorelease]; 
        break;
    default: 
        viewController = [[[UIViewController alloc] init] autorelease];
} 
[self.navigationController pushViewController:viewController animated:YES];
  }

When i press the tableviewcell then it should display MySegue viewController but it gives error message that Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'MySegue''.

Why it is giving error when storyboardsegue identifier is there.

Thanks for help.

1
Are you sure this view controller was loaded from a storyboard? Try putting NSLog(@"my storyboard = %@", self.storyboard); at the top of your method. Does it log a storyboard, or does it log null? - rob mayoff

1 Answers

3
votes

There are several things you could try to make this work:

1) Try renaming the storyboard and make sure to set the main storyboard in the project settings and in the info.plist file (Key is 'Main storyboard file base name')

2) Try doing a clean of the product (Product -> Clean)

3) Try deleting the app from the simulator and running it again (this could work if done after you did the second point)

4) If your project is has localization and multiple storyboards for different locales, make sure that the storyboards are the same

5) Segue identifiers are case sensitive. Make sure that you type the exact identifier (usually I just copy it from the Attributes Inspector and paste it in my code, makes me feel more safe)

6) This may look obvious - but make 100 percent sure that the segue does actually exist! We get tired sometimes :)

Hope this helps.