Question

I am getting an intermittent crash on my application. Crash log makes me think that there seems to be some issue the way UITextField's resignFirstResponser is being called. I am using UITextField and UITextFieldDelegate protocol methods in my custom tableview cell which is resulting in a crash intermittently. I am posting the crash log below. Please any suggestions or comments that could help me understand the root cause of the crash would be great. Also, it seems like the crash is happening mostly on iOS 6

Thanks.

Following is the Crittercism crash log:

    0   libobjc.A.dylib 0x39d585b0 objc_msgSend + 16 + 15
    1   UIKit 0x3477f165 -[UITextField _resignFirstResponder] + 457 + 456
    2   UIKit 0x34664249 -[UIResponder resignFirstResponder] + 281 + 280
    3   UIKit 0x34712397 -[UITextField resignFirstResponder] + 147 + 146
    4   UIKit 0x346962f5 -[UITableView reloadData] + 225 + 224
    5   BF 0x0008ed37 -[BFOpenBetsController updateFilterData] (BFOpenBetsController.m:768)
    6   BF 0x0008d695 -[BFOpenBetsController deleteBet:] (BFOpenBetsController.m:566)
    7   BF 0x00094fbd -[BFOpenBetsUnMatchedCell userTapOnButton:] (BFOpenBetsUnMatchedCell.m:198)
    8   UIKit 0x347380a5 -[UIApplication sendAction:to:from:forEvent:] + 73 + 72
    9   UIKit 0x34738057 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 31 + 30
    10  UIKit 0x34738035 -[UIControl sendAction:to:forEvent:] + 45 + 44
    11  UIKit 0x347378eb -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503 + 502
    12  UIKit 0x34737de1 -[UIControl touchesEnded:withEvent:] + 489 + 488
    13  UIKit 0x34656421 _UIGestureRecognizerUpdate + 5769 + 5768
    14  CoreFoundation 0x351536cd __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 21 + 20
    15  CoreFoundation 0x351519c1 __CFRunLoopDoObservers + 277 + 276
    16  CoreFoundation 0x35151d17 __CFRunLoopRun + 743 + 742
    17  CoreFoundation 0x350c4ebd CFRunLoopRunSpecific + 357 + 356
    18  CoreFoundation 0x350c4d49 CFRunLoopRunInMode + 105 + 104
    19  GraphicsServices 0x32a172eb GSEventRunModal + 75 + 74
    20  UIKit 0x346a12f9 UIApplicationMain + 1121 + 1120

Was it helpful?

Solution

It's possible that one of your UITextFields are being deallocated (as they do when scrolled out of view, or perhaps when the view is reloaded). Seeing as you've got a TextField delegate, its likely it's unaware that the field no longer exists, so when it calls resign first responder, it crashes.

The solution being to call uitextfield setDelegate:nil in the dealloc routine of your custom cell.

See https://stackoverflow.com/a/9484805/899996

OTHER TIPS

It seems like when updating your filter data, you reload the tableview and that time some UITextField is in editing mode. Try to reproduce with something like this.

If this is the issue, try resignFirstResponder on all your active UITextField before calling reloadData on UITableView.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top