I have a tableViewController and when a cell is clicked, I want to record the name of the cell and pass it to a new QuestionViewController programatically. The problem I'm getting is that when the cell is clicked, I get an error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'segueToViewController''
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
self.name = [self.listOfNames objectAtIndex:indexPath.row];
NSLog(@"selected cell: %i, %@", (int)indexPath.row, self.listOfNames);
[self performSegueWithIdentifier:@"segueToViewController" sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
NSLog(@"prepare for segue: %@", segue.identifier);
if ([[segue identifier] isEqualToString:@"segueToViewController"]){
QuestionViewController *QVC = segue.destinationViewController;
QVC.currentResidentName = [[NSString alloc] initWithString:self.name];
}
}
Any idea how to make the segue work? I'm not sure why prepareForSegue is not able to identify the segue.
NSLog prints:
selected cell: 0, 123456789
which is good, but it doesn't get to the "prepare for segue" NSLog. When I debug the problem, it crashes right at prepareForSegue