unrecognized selector sent to instance

Posted by iamsmug on Stack Overflow See other posts from Stack Overflow or by iamsmug
Published on 2010-04-05T20:46:28Z Indexed on 2010/04/05 21:03 UTC
Read the original article Hit count: 238

Filed under:

My app works fine in the simulator but when I run it on my phone I get this error:

2010-04-05 21:32:45.119 Top Banana[119:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[MethodViewController setReferringObject:]: unrecognized selector sent to instance 0x16e930'

It happens here:

-(void)method {

 [UIView beginAnimations:@"View Flip" context:nil];
 [UIView setAnimationDuration:0.50];
 [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

 [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
 MethodViewController *methodViewController = [[MethodViewController alloc] initWithNibName:@"MethodViewController" bundle:0];   

 NSManagedObject *selectedObject = self.referringObject;
 methodViewController.referringObject = selectedObject;

 [self.navigationController pushViewController:methodViewController animated:NO];

 methodViewController.title = @"Method";

 [UIView commitAnimations];

 [MethodViewController release]; 
}

It crashes on this line:

methodViewController.referringObject = selectedObject;

Not sure how to resolve this as it works in the simulator, I'm sure it is fairly basic to fix, any help will be appreciated.

© Stack Overflow or respective owner

Related posts about iphone