我有一个导航 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];
}
最佳答案
我遇到了同样的问题,实际上我的问题是我在打电话
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/