我有一个ViewController作为其数据源和委托的UITableView。在同一个XIB中,我为我的搜索栏定制了一个单元格。表格视图中的第一个单元格是这个单元格。偶尔,我得到一个崩溃但下列情况除外:UITableViewCell无法识别的选择器
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCell numberOfSectionsInTableView:]: unrecognized selector sent to instance 0x5d76840'
GDB显示,其实这是我的搜索细胞,它是实现代码如下的一个孩子。此外,进一步的检查显示数据源实际上正确地指向我的视图控制器,而不是搜索栏单元。基于此,UIKit似乎只是将消息发送给错误的目标。任何人都看过这样的事情吗?难道这只是模拟器中的问题吗?
完整的堆栈:
*** Call stack at first throw:
(
0 CoreFoundation 0x012955a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x013e9313 objc_exception_throw + 44
2 CoreFoundation 0x012970bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01206966 ___forwarding___ + 966
4 CoreFoundation 0x01206522 _CF_forwarding_prep_0 + 50
5 UIKit 0x006a26ff -[UITableViewRowData(UITableViewRowDataPrivate) _updateNumSections] + 111
6 UIKit 0x006a23b0 -[UITableViewRowData invalidateAllSections] + 66
7 UIKit 0x00559d23 -[UITableView(_UITableViewPrivate) _updateRowData] + 113
8 UIKit 0x0055565c -[UITableView noteNumberOfRowsChanged] + 105
9 UIKit 0x00562708 -[UITableView reloadData] + 773
10 Foundation 0x00c6e94e __NSThreadPerformPerform + 251
11 CoreFoundation 0x012768ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
12 CoreFoundation 0x011d488b __CFRunLoopDoSources0 + 571
13 CoreFoundation 0x011d3d86 __CFRunLoopRun + 470
14 CoreFoundation 0x011d3840 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x011d3761 CFRunLoopRunInMode + 97
16 GraphicsServices 0x01d3e1c4 GSEventRunModal + 217
17 GraphicsServices 0x01d3e289 GSEventRun + 115
18 UIKit 0x004f5c93 UIApplicationMain + 1160
19 iPanopto 0x000020f9 main + 121
20 iPanopto 0x00002075 start + 53
)
它会不会被正确连接?出口有问题吗?单元格与tableview在相同的NIB中定义。 – George
必须将类标识符设置为单元格的特定自定义类 – craig1231
仅使用UITableViewCell是否是错误的?我没有任何特殊的行为,我想要处理单元类,我只是让视图控制器处理这一切。 – George