3

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

Community
  • 1
  • 1
user969043
  • 756
  • 2
  • 13
  • 34

3 Answers3

6

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

Kjuly
  • 34,476
  • 22
  • 104
  • 118
1

I think the issue is that you are sending the method gotoTone: to a Tone object, however this method is defined within the Forside object. I'm not sure exectly why this is happening, however I suggest checking the connections within you xib file.

Craig Watkinson
  • 903
  • 10
  • 20
0

You haven't provided any information about how your button is configured, but if the button is in your nib file, it seems likely that the identity of the button's target is set to the wrong class. So make sure that the class of the object the button sends its message to is Forside rather than Tone.

jlehr
  • 15,557
  • 5
  • 43
  • 45