Question

I want to load another xib, and use this simple code:

AddElementViewController *viewToLoad = [[AddElementViewController alloc] initWithNibName:@"AddElementViewController" bundle:nil];
viewToLoad.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:viewToLoad animated:YES];

for some reason it throws me out with this output:

2012-03-11 11:56:57.990 Weesh[14650:11603] -[MainViewController AddPressed:]:     unrecognized selector sent to instance 0x7b55b40
2012-03-11 11:56:57.991 Weesh[14650:11603] *** Terminating app due to uncaught exception     'NSInvalidArgumentException', reason: '-[MainViewController AddPressed:]: unrecognized     selector sent to instance 0x7b55b40'
*** First throw call stack:
(0x13da052 0x198ed0a 0x13dbced 0x1340f00 0x1340ce2 0x13dbec9 0x32a5c2 0x32a55a 0x3cfb76     0x3d003f 0x3cf2fe 0x34fa30 0x34fc56 0x336384 0x329aa9 0x22c7fa9 0x13ae1c5 0x1313022     0x131190a 0x1310db4 0x1310ccb 0x22c6879 0x22c693e 0x327a9b 0x1cad 0x1c15)
terminate called throwing an exception(lldb) 

do you have any idea what can cause it?

Was it helpful?

Solution

Somewhere in your code (it seems to be in AddElementViewController implementation) you are sending message AddPressed: to object of class MainViewController.

The call stack and crash error says that there are no method AddPressed: in class MainViewController.

Try to find all places where you are calling AddPressed: (first of all check loadView, viewDidLoad, viewWillAppear, viewDidAppear, init of AddElementViewController class) and check the type of receiver.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top