Tableview - unrecognized didSelectRowAtIndexPath selector

I had a problem with my application crashing when selecting something in the tableView. This is not 100% reproducible, but it happens relatively often.

What happens inside my EventListViewController class (subclass of UITableViewController), I overwrite the didSelectRowAtIndexPath function, because I also use the search bar in this class, and I want it to select only when you are not doing a search.

The code is as follows:

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

However, when it fails, I throw an exception and this message appears on the line that calls the superfunction:

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

I printed some things in the debugger and it all looks good 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 table has 2 sections, and the second section has 2 entries)

- , ? , .

: , 100% : 1: . 2: tableView 3: , , , , indexPath , View, tableView didSelectRowAtIndexPath

+5
1

super tableView:didSelectRowAtIndexPath: . , UITableViewController . , .

+19

All Articles