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

MicahKE picture MicahKE · Dec 21, 2013 · Viewed 23.4k times · Source

I have a navigation controller that has a segue links between them called "addSegue". When I click on the tableView cell though the app crashes and I get the error below:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<MSAddFriendsViewController: 0x98cc340>) has no segue with identifier 'addSegue'

I don't think that I have any issues with my code. Here is the method in which I have the line showSegueWithIdentifier:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSMutableSet *selectedUsers = [NSMutableSet set];

[self.tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];


cell.accessoryType = UITableViewCellAccessoryCheckmark;
PFRelation *friendsRelation = [self.currentUser relationforKey:@"friendsRelation"];
PFUser *user = [self.allUsers objectAtIndex:indexPath.row];
[friendsRelation addObject:user];
[self.currentUser saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    if (error) {
        NSLog(@"Error %@ %@", error, [error userInfo]);

    }    }];

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

}

Here is a picture of my storyboard

Here is an updated picture of my storyboard

Answer

ooxio picture ooxio · May 5, 2015

I had this same problem and actually my problem was that I was calling

WRONG: [self.navigationController performSegueWithIdentifier:@"ShowVerify" sender:self];

instead of

CORRECT: [self performSegueWithIdentifier:@"ShowVerify" sender:self];

so check that you are calling correct performSegueWithIdentifier method :)