简体   繁体   English

tableview-无法识别的选择器didSelectRowAtIndexPath

[英]tableview - unrecognized selector didSelectRowAtIndexPath

I have been having an issue with my app crashing on selecting something in the tableView. 我在选择tableView中的某个应用程序时遇到了崩溃的问题。 This is not 100% reproducible, but it happens relatively often. 这不是100%可重复的,但它相对经常发生。

What happens is inside my EventListViewController class (a subclass of UITableViewController), I overwrite the didSelectRowAtIndexPath function because I am using a search bar in this class as well, and I want it to only select when you are not searching. 发生了什么事在我的EventListViewController类(UITableViewController的子类)内部,我覆盖了didSelectRowAtIndexPath函数,因为我也在此类中使用了搜索栏,并且希望仅在不搜索时才选择它。

The code looks like this: 代码如下:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(!searching)
        [super tableView:tableView didSelectRowAtIndexPath:indexPath];
}

However, when it crashes, I break on exception and this is the message I get, on the line that calls the super function: 但是,当它崩溃时,我中断了异常,这是在调用super函数的那一行上得到的消息:

[EventListViewController tableView:didSelectRowAtIndexPath:]: unrecognized selector sent to instance 0xa648e50

I printed out some stuff on the debugger and it all looks fine to me: 我在调试器上打印了一些东西,对我来说一切都很好:

(lldb) po 0xa648e50
(int) $1 = 174362192 <EventListViewController: 0xa648e50>

(lldb) po self
(EventListViewController *) $2 = 0x0a648e50 <EventListViewController: 0xa648e50>

(lldb) po tableView
(UITableView *) $3 = 0x070fd400 <UITableView: 0x70fd400; frame = (0 0; 320 367); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x6e46750>; contentOffset: {-0, -0}>

(lldb) po indexPath
(NSIndexPath *) $4 = 0x06e8caf0 <NSIndexPath 0x6e8caf0> 2 indexes [1, 1]

(The tableView has 2 sections,and the second section has 2 entries) (tableView有2个部分,第二个部分有2个条目)

Anyone have any Idea what is happening? 任何人都知道发生了什么事吗? let me know if you need any more information. 让我知道您是否需要更多信息。

Note: after more investigation I have found that this is 100 % reproducible with the following steps: 1: load the app, and click on either of the two entries. 注意:经过更多调查,我发现通过以下步骤可以100%重现该代码:1:加载应用程序,然后单击两个条目之一。 2: Go back to the tableView controller 3: tap BELOW both of the entries, in the white space where there shouldn't be a cell The app will crash, but notice that the indexPath doesn't say its trying to select a cell that is outside the bounds of the tableView, just that the tableView didSelectRowAtIndexPath method doesn't exist 2:返回tableView控制器3:在不应该存在单元格的空白处,点击两个条目下面的应用程序将崩溃,但请注意indexPath并未说它试图选择一个单元格在tableView的边界之外,只是tableView didSelectRowAtIndexPath方法不存在

The call to super in tableView:didSelectRowAtIndexPath: is unnecessary. tableView:didSelectRowAtIndexPath:super的调用是不必要的。 If I remember correctly, UITableViewController does not provide a default implementation of that method. 如果我没记错的话, UITableViewController不提供该方法的默认实现。 Thus, your call to super results in a crash. 因此,您对super的调用会导致崩溃。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 [NSArrayM tableView]:无法识别的选择器 - NSArrayM tableView]: unrecognized selector 具有自定义tableview单元格的无法识别的选择器 - unrecognized selector with custom tableview cell 表格视图didSelectRowAtIndexPath - Tableview didSelectRowAtIndexPath [ComponentTaleView tableView:heightForFooterInSection:]:无法识别的选择器已发送到实例 - [ComponentTaleView tableView:heightForFooterInSection:]: unrecognized selector sent to instance tableView.datasource =自身错误:无法识别的选择器 - tableView.datasource = self error:unrecognized selector TableView在reloadData上崩溃 - &#39;无法识别的选择器发送到实例&#39; - TableView Crashes on reloadData - 'unrecognized selector sent to instance' tableview无法正常工作 - [UIViewController tableView:numberOfRowsInSection:]:无法识别的选择器发送到实例 - tableview not working - [UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 故事板上的2个表格视图的cellForRowAtIndexPath,无法识别的选择器发送到实例错误 - cellForRowAtIndexPath for 2 tableview in a storyboard, unrecognized selector sent to instance error 使用AppDelegate tableView:numberOfRowsInSection启动时,应用程序崩溃:无法识别的选择器发送到实例 - App Crashing on launch with AppDelegate tableView:numberOfRowsInSection: unrecognized selector sent to instance _NSCFString tableView:heightForHeaderInSection:]无法识别的选择器-需要帮助调试 - _NSCFString tableView:heightForHeaderInSection:]unrecognized selector - Need help debugging
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM