'Receiver(<ViewController>)没有标识符“addSegue”

我有一个导航控制器之间有一个segue链接,称为“addSegue”。 当我点击tableView单元格,虽然应用程序崩溃,我得到下面的错误:

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

我不认为我的代码有任何问题。 这里是我有showSegueWithIdentifier行的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]; } 

这是我的故事板的图片

这里是我的故事板的更新图片

我也遇到了同样的问题,其实我的问题就是我打来的电话

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

代替

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

所以检查你是否调用了正确的performSegueWithIdentifier方法:)

在这里输入图像描述

 use segue identifier in Push Method and give the proper connection 

如果您使用的是Identifier ,请在需要的地方拨打此行

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

Swift 2.X

 self.performSegueWithIdentifier("identifierName", sender: self) 

Swift 3

 self.performSegue(withIdentifier: "identifierName", sender: self) 

关于你添加的新屏幕。 在这个屏幕上,当你完成并想要删除它时,它只是:

 self.dismiss(animated: false, completion: nil) 

很难说,但其他一些人也有类似的问题:

  • 在这个问题中 ,提问者用init初始化了故事板,而不是instantiateViewControllerWithIdentifier所以segue没有正确设置。

  • 在这个问题上 ,这只是奇怪的内部与Xcode和模拟器,并运行产品 – >清洁帮助。

  • 当然,代码中的segue名称可能与Storybord上的segue名称不匹配,但是我猜你已经检查了很多次了!

检查UIKIT是否在头文件中。 我不知不觉地把新的VC作为View Controller的一个子类。