hump
hump

Reputation: 53

unrecognized selector sent to instance on ios table view cell click

I'm a very beginner to iOs. I'm going to view a list in table view controller. My application is a story board application. I did the following code to go to the next view.

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   LawyerViewController *dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"LawyerViewController"];
   dvc.lawyer = @"Thisara";//[self.myObject objectAtIndex:indexPath.row];
   [self.navigationController pushViewController:dvc animated:YES];
}

in my LawyerViewController header file I defined the following property.

@property (nonatomic, strong) NSString *lawyer;

When I'm clicking on the cell, I've got following error.

2014-07-26 23:56:14.420 lawyerapp[3626:60b] -[UIViewController setLawyer:]: unrecognized        selector sent to instance 0x8cdd1f0
2014-07-26 23:56:14.424 lawyerapp[3626:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setLawyer:]:      
unrecognized selector sent to instance 0x8cdd1f0'

How do I fix this.

Thanks in Advance!

Upvotes: 1

Views: 1429

Answers (1)

codester
codester

Reputation: 37189

You have not defined the class in storyBoard.

Go to your viewController in StoryBoard -> than identity Inspector -> class -> Put the class LawyerViewController.

enter image description here Clean,build and run

Upvotes: 5

Related Questions