Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

willmeister

macrumors newbie
Original poster
Jun 13, 2010
8
0
I cannot understand why the GDB craps out saying "unrecognized selector" when there it is connected to the appropriate method inside Interface Builder. What I have to add is that I'm using a View Controller, and the IBAction is defined inside the view controller.

Program compiles fine with no warnings but every time I press a button, the application abruptly terminates.

Any thoughts?
 

willmeister

macrumors newbie
Original poster
Jun 13, 2010
8
0
*** -[UIViewController pushController:]: unrecognized selector sent to instance 0x471aba0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController pushController:]: unrecognized selector sent to instance 0x471aba0'

I've tried changing the argument classes as if that would help but tried anyway.
Made sure I named things correctly and everything was connected up properly in IB. I just can't figure out where I went wrong. The only argument is of type id coming from a UIButton so... the instance, I'm pretty sure is my UIViewController with the action method.

- (IBAction) pushController: (id) sender;

I've tried:

- (IBAction) pushController: (UIButton *) sender;

Another thing I've noticed is that when I try to add a button to the ViewController's view it doesn't show up at all.
 

willmeister

macrumors newbie
Original poster
Jun 13, 2010
8
0
You know when you make such ... basic mistakes you don't see them?

Turns out that UIViewController doesn't have a defined action called pushController. That will be found in *my* custom UIViewController.

What I did was

UIViewController *rootViewController = [[UIViewController alloc] initWith...]

etc etc etc

Helps when one uses their own custom classes to get custom behaviours. :p
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.