Reputation: 2821
Basically, I get the error:
-[UIViewController donePress:]: unrecognized selector sent to instance 0x6a7f7c0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController donePress:]: unrecognized selector sent to instance 0x6a7f7c0'
*** First throw call stack:
(0x13cd022 0x155ecd6 0x13cecbd 0x1333ed0 0x1333cb2 0x13cee99 0x1a14e 0x1a0e6 0xc0ade 0xc0fa7 0xc0266 0x3f3c0 0x3f5e6 0x25dc4 0x19634 0x12b7ef5 0x13a1195 0x1305ff2 0x13048da 0x1303d84 0x1303c9b 0x12b67d8 0x12b688a 0x17626 0x1d6d 0x1cd5)
terminate called throwing an exception
whenever I press a button. This button is in a second view which has been loaded by:
replacementController = [[UIViewController alloc] initWithNibName:@"NFCController" bundle:nil];
[self.view addSubview:self.replacementController.view];
The button was connected to a class by using the split pane view and control dragging to the header file. Xcode generated the relevant methods. However, now when I click the button it crashes with the error above.
If there is any more info that you need, please let me know.
Thanks
Upvotes: 1
Views: 101
Reputation: 21221
You are initializing a UIViewController
instead of an NFCController
change the initialization to
replacementController = [[NFCController alloc] initWithNibName:@"NFCController" bundle:nil];
Explanation: the object that is being created is a UIViewController and not an NFCController And UIViewController does not have a function called donePress:, hence you receive the error
Upvotes: 4