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
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 :)
use segue identifier in Push Method and give the proper connection
if you are using Identifier
, then call this line where u need
[self performSegueWithIdentifier:@"identifierName" sender:self];
Swift 2.X
self.performSegueWithIdentifier("identifierName", sender: self)
Swift 3
self.performSegue(withIdentifier: "identifierName", sender: self)
Regarding the new screen you have added that way. In that screen, when you're finished and want to remove it, it's just:
self.dismiss(animated: false, completion: nil)
Hard to say for sure, but some other people have had similar problems:
In this question, the asker instantiated the storyboard with
init
instead of instantiateViewControllerWithIdentifier
so the
segue wasn't set up properly.
In this question, it was just something weird going on internally with xcode and the simulator, and running Product->Clean helped.
And of course, it's possible the segue name in the code doesn't match the segue name on the Storybord, but I'm guessing you've checked that a lot of times already!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With