1

基本上,我得到了错误:

-[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

每当我按下一个按钮。此按钮位于第二个视图中,已由以下人员加载:

replacementController = [[UIViewController alloc] initWithNibName:@"NFCController" bundle:nil];
[self.view addSubview:self.replacementController.view];

该按钮通过使用拆分窗格视图和控件拖动到头文件连接到一个类。Xcode 生成了相关的方法。但是,现在当我单击按钮时,它会因上述错误而崩溃。

如果您需要更多信息,请告诉我。

谢谢

4

1 回答 1

4

您正在初始化 aUIViewController而不是NFCController

将初始化更改为

replacementController = [[NFCController alloc] initWithNibName:@"NFCController" bundle:nil];

说明:正在创建的对象是 UIViewController 而不是 NFCController 并且 UIViewController 没有名为 donePress: 的函数,因此您收到错误

于 2012-06-08T11:01:06.383 回答