ios - '接收器 (<ViewController>) 没有标识符为 'addSegue' 的 segue

标签 ios objective-c iphone swift uistoryboardsegue

我有一个导航 Controller ,它们之间有一个名为“addSegue”的 segue 链接。当我点击 tableView 单元格时,虽然应用程序崩溃了,但我收到以下错误:

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

我认为我的代码没有任何问题。这是我在其中包含 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

最佳答案

我遇到了同样的问题,实际上我的问题是我在打电话

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

代替

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

因此请检查您是否调用了正确的 performSegueWithIdentifier 方法 :)

关于ios - '接收器 (<ViewController>) 没有标识符为 'addSegue' 的 segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20715462/

相关文章:

iOS Deep linking and Universal link,如何在ios中进行深度链接

iphone - 通过解析 XML 传递 UITableView

ios - 如何将当前日期转换为特定的 24 小时格式?

iphone - 在 iOS 中添加按下保持按钮的回调

ios - ivars 和循环方法

objective-c - 如何为 iOS 中的按钮添加声音?

ios - 在 UITextVIew 编辑为真时检测 NSAttributedString 中附加图像的点击

ios - ABAddressBook 规范化电话号码

ios - 如何设置按钮标题的字体 Objective-C

iphone - iOS - 当设置为 0 时 UICollectionView 间距仍然存在 - 如何设置单元格之间没有间距