Reputation: 2225
XCode is driving me crazy (again). How do people use this?
-[UIViewController look_for_offer:]: unrecognized selector sent to instance 0x4e34220
2011-04-30 18:38:25.207 myApp[8261:40b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController look_for_offer:]: unrecognized selector sent to instance 0x4e34220'
Here's what I did. I made a button. I clicked on the button and went to the "connections" tab in the inspector. I dragged from the touch-down-event to the code and it automatically created an empty method and a method header. This is the method:
- (IBAction)look_for_offer:(id)sender {
}
Now remember, I didn't even write that. Interface Builder generated it for me. Yet when I build and click the button, I get the "unrecognized selector" error message.
It looks from the error message like he's trying to send the message look_for_offer to UIViewController. I don't know why he would do that. The method is in my view, which is a subclass of UIViewController:
@interface ClientSeekingView : UIViewController {
}
- (IBAction)look_for_offer:(id)sender;
I clearly dragged the action into that classes code, not into UIViewController. Why is he trying to send messages to UIViewController instead of my class?
What am I doing wrong? How do I please Xcode?
PS: I cleaned and rebuilt several times, doesn't help.
MrB
Upvotes: 1
Views: 8031
Reputation: 5259
It looks like you didn't change the Interface Builder File's Owner
object to your own class. IB has created an object of type UIViewController
, not ClientSeekingView
. The error message says that your selector is being sent to an object of class UIViewController
.
To change the class, you would use the Identity Inspector.
Upvotes: 9