unrecognized selector sent to instance (iOS)

user969043 picture user969043 · Sep 28, 2011 · Viewed 18.5k times · Source

Possible Duplicate:
unrecognized selector sent to instance

Well... like so many others, I have gotten a "unrecognized selector sent to instance" error...

The problem occurs when I press a button, e.g. in this case:

-(IBAction)gotoTone:(id)sender
{
    if(self.tone == nil)
    {
       Tone *toneMain = [[Tone alloc]
                              initWithNibName:@"Tone" bundle:[NSBundle mainBundle]];
       self.tone = toneMain;
       [toneMain release];
    }

    [self.navigationController pushViewController:tone animated:YES];
}

The error is: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Tone gotoTone:]: unrecognized selector sent to instance 0x531caa0'

The error started occurring after I inserted a new view as the first view presented to the user... Also, I use a navigation bar and at first I had forgotten to go into MainWindow.xib and change the Navigation Controller to the new view, but that is fixed now.

You can see my entire code her:

The .h in which the file occurs: http://snipt.org/xnoO The .m in which the file occurs: http://snipt.org/xnoM

Don't mind all the out-commented lines, that's just until I get this fixed...

I've tried finding a solution to this by reading other cases of "unrecognized selector sent to instance", but I guess I'm just not seeing the solution. I've checked my IB-connects, I've cleaned the project and such...

Any help would be greatly appreciated

Answer

Kjuly picture Kjuly · Oct 27, 2011

I met this issue and solved it just by reconnected the Button to the IBAction whose name was modified before. So embarrassing.