0
votes

when i click on cell it direct crash and cannot come on cell didSelectRowAtIndexPath, and give this error

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIGestureDelayedTouch tableView:didSelectRowAtIndexPath:]: unrecognized selector sent to instance 0x1294e8b0'
*** First throw call stack:
(
    0   CoreFoundation                      0x041381e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x03eb38e5 objc_exception_throw + 44
    2   CoreFoundation                      0x041d5243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x0412850b ___forwarding___ + 1019
    4   CoreFoundation                      0x041280ee _CF_forwarding_prep_0 + 14
    5   UIKit                               0x02c5d9a1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
    6   UIKit                               0x02c5db14 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
    7   UIKit                               0x02c6210e __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
    8   UIKit                               0x02b910aa ___afterCACommitHandler_block_invoke + 15
    9   UIKit                               0x02b91055 _applyBlockToCFArrayCopiedToStack + 403
    10  UIKit                               0x02b90e76 _afterCACommitHandler + 532
    11  CoreFoundation                      0x0410036e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    12  CoreFoundation                      0x041002bf __CFRunLoopDoObservers + 399
    13  CoreFoundation                      0x040de254 __CFRunLoopRun + 1076
    14  CoreFoundation                      0x040dd9d3 CFRunLoopRunSpecific + 467
    15  CoreFoundation                      0x040dd7eb CFRunLoopRunInMode + 123
    16  GraphicsServices                    0x0480c5ee GSEventRunModal + 192
    17  GraphicsServices                    0x0480c42b GSEventRun + 104
    18  UIKit                               0x02b73f9b UIApplicationMain + 1225
    19  Translator                          0x000423ed main + 141
    20  libdyld.dylib                       0x053de701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [favouriteArray count];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 110;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *simpleTableIdentifier = @"SimpleTableCell";

    simpleTableCell *cell = (simpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil)

    {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"simpleTableCell" owner:self options:nil];

        cell = [nib objectAtIndex:0];

    }


    FavouriteDC *application = [favouriteArray objectAtIndex:[indexPath row]];

    cell.lblWord.text =  application.from_Lan;

    [cell setBackgroundColor:[UIColor clearColor]];

    cell.lblMeaning.text=application.to_Lang;

    return cell;




}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}


- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

{


    FavouriteDC * application = [favouriteArray objectAtIndex:[indexPath row]];

    // If row is deleted, remove it from the list.

    if (editingStyle == UITableViewCellEditingStyleDelete)
    {
        GET_DBHANDLER

        [dbHandler deleteFromFavorites:application.favo_id];

        [favouriteArray removeObjectAtIndex:indexPath.row];

        // delete your data item here

        // Animate the deletion from the table.

        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] 
withRowAnimation:UITableViewRowAnimationFade];

    }

}
1
have you added any gesture recognizer in class SimpleTableCell?Fawad Masud
no i have no gesture recognizerSoftCoder
please help me i have alot of try to fix itSoftCoder
How and when are you setting the delegate? What retains the delegate?Wain
Does your GET_DBHANDLER macro by any chance set tableView?Hot Licks

1 Answers

0
votes

Have you set Tableview delegate to UITableViewDelegate using the storyboard or programmatically?

set Tableview delegate to UITableViewDelegate programmatically.

yourtableview.dataSource=self

or

using storyboard set Tableview delegate to UITableViewDelegate Tableview delegate to UITableViewDelegate