Uitableview 在自定义UlTableViewCell中使用UITextField时,resignFirstResponder崩溃

Uitableview 在自定义UlTableViewCell中使用UITextField时,resignFirstResponder崩溃,uitableview,ios6,crash,uitextfield,uitextfielddelegate,Uitableview,Ios6,Crash,Uitextfield,Uitextfielddelegate,我的应用程序间歇性崩溃。崩溃日志让我觉得UITextField的辞职FirstResponser的调用方式似乎存在一些问题。我在自定义tableview单元格中使用UITextField和UITextFieldDelegate协议方法,这会导致间歇性崩溃。我在下面发布了坠机日志。请提供任何建议或意见,以帮助我了解崩溃的根本原因将是伟大的。而且,崩溃似乎主要发生在iOS 6上 谢谢 以下是Critercism崩溃日志: 0 libobjc.A.dylib 0x39d585b0 objc_msg

我的应用程序间歇性崩溃。崩溃日志让我觉得UITextField的辞职FirstResponser的调用方式似乎存在一些问题。我在自定义tableview单元格中使用UITextField和UITextFieldDelegate协议方法,这会导致间歇性崩溃。我在下面发布了坠机日志。请提供任何建议或意见,以帮助我了解崩溃的根本原因将是伟大的。而且,崩溃似乎主要发生在iOS 6上

谢谢

以下是Critercism崩溃日志:

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 0 libobjc.A.dylib 0x39d585b0 objc_msgSend+16+15 1 UIKit 0x3477f165-[UITextField\u辞职第一响应者]+457+456 2 UIKit 0x34664249-[UIResponder Responder resignFirstResponder]+281+280 3 UIKit 0x34712397-[UITextField resignFirstResponder]+147+146 4 UIKit 0x346962f5-[UITableView重新加载数据]+225+224 5 BF 0x0008ed37-[BFOpenBetsController更新过滤器数据](BFOpenBetsController.m:768) 6 BF 0x0008d695-[BFOpenBetsController deleteBet:](BFOpenBetsController.m:566) 7 BF 0x00094fbd-[BFOpenBetsUnMatchedCell用户点击按钮:](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发送操作:到:forEvent:+45+44 11 UIKit 0x347378eb-[UIControl(内部)\发送操作预防:带事件:+503+502 12 UIKit 0x34737de1-[UIControl触摸已选择:带事件:+489+488 13 UIKit 0x34656421消化识别器更新+5769+5768 14 CoreFoundation 0x351536cd运行循环正在调用一个观察者回调函数 15 CoreFoundation 0x351519c1\uu cfrunloopdoobserver+277+276 16 CoreFoundation 0x35151d17\uuu CFRunLoopRun+743+742 17 CoreFoundation 0x350c4ebd CFRunLoopRunSpecific+357+356 18 CoreFoundation 0x350c4d49 CFRunLoopRunInMode+105+104 19图形服务0x32a172eb GSEventRunModal+75+74 20 UIKit 0x346a12f9 UIApplicationMain+1121+1120
似乎在更新过滤器数据时,您重新加载了tableview,此时某个
UITextField
处于编辑模式。 试着用这样的方法复制


如果这是问题所在,请在调用
UITableView
上的
reloadData
之前,在所有活动的
UITextField上尝试
resignFirstResponder
,您的UITextField中有一个可能正在被解除分配(当滚动出视图时,或者当视图重新加载时)。鉴于您有一个TextField委托,它很可能不知道该字段已不存在,因此当它调用responder first responder时,它会崩溃

解决方案是在自定义单元格的dealloc例程中调用uitextfield setDelegate:nil


请参见

崩溃的情景是什么?它是在仅仅显示后还是在滚动等之后崩溃的?@AkshayShah:实际上,这是一个Critercism日志。用户在实时版本中看到它,我无法复制它,因此它似乎是一个间歇性的问题。我的理解是,它会在稍后重新加载tableView时发生,因此可能类似于滚动或更新tableView,而不是在初始数据显示后的乞讨中。同样,即使滚动也不会一直使其崩溃。所以我想可能是我的文本字段被选中了,然后tableView被重新加载了,或者什么的,但是我不确定只是想从日志中找出一些问题。