我想加载另一个xib,并使用这个简单的代码:
AddElementViewController *viewToLoad = [[AddElementViewController alloc] initWithNibName:@"AddElementViewController" bundle:nil];
viewToLoad.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:viewToLoad animated:YES];
出于某种原因,它让我输出这个输出:
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)
你知道是什么原因引起的吗?
答案 0 :(得分:2)
您的代码中的某处(似乎在AddElementViewController
实现中)您正在向类AddPressed:
的对象发送消息MainViewController
。
调用堆栈和崩溃错误表示类AddPressed:
中没有方法MainViewController
。
尝试找到您呼叫的所有地方AddPressed:
(首先检查loadView
,viewDidLoad
,viewWillAppear
,viewDidAppear
,{{1} } init
类}并检查接收器的类型。