Question

I am trying to push a view controller on the navigation stack with following code in my buttonPressed method

-(IBAction) viewButtonPressed:(id)sender {

PersonDetailViewController *personDetailViewController = [[PersonDetailViewController alloc] initWithNibName:@"PersonDetailViewController" bundle:nil];
[self.navigationController pushViewController:personDetailViewController animated:YES];
[personDetailViewController release];

}

I ran the debugger and it throws the exception after followin line is stepped over from above code.

[self.navigationController pushViewController:personDetailViewController animated:YES];

This is pretty standard call ... it has worked many times before without any problems. Any idea what am I missing here? I am stuck at this point and not able to drill down further.

Here are the error messages on the console after running the debugger

2009-10-30 18:15:11.127 Untitled[6089:20b] * -[NSCFString image]: unrecognized selector sent to instance 0x3050 2009-10-30 18:15:11.129 Untitled[6089:20b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString image]: unrecognized selector sent to instance 0x3050' 2009-10-30 18:15:11.130 Untitled[6089:20b] Stack: ( 807902715, 2460638779 ...

Was it helpful?

Solution

The problem was in one of the init methods where I was setting the back button item incorrectly.

OTHER TIPS

I would start by looking inside the view lifecycle methods - viewWillAppear, viewDidAppear etc. - in the PersonDetailViewController class for invocations of a method named image on some object instance.

You can also try stepping through these methods in an attempt to narrow down where this invocation is made.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top