UIResponder(Static) _setFirstResponder: break

3

I have no any idea about tihs break, Can you provide some clues for me, Any help would be appreciated.

  • thread #1: tid = 0x29927, 0x37c47b66 libobjc.A.dylib`objc_msgSend + 6, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x8000000c)

frame #0: 0x37c47b66 libobjc.A.dylib`objc_msgSend + 6

frame #1: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #2: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #3: 0x3012cce0 UIKit`-[UIResponder(Static) _setFirstResponder:] + 44
frame #4: 0x30118732 UIKit`-[UIResponder resignFirstResponder] + 250
frame #5: 0x3027bb68 UIKit`-[UIWebDocumentView resignFirstResponder] + 232
frame #6: 0x3027ba7c UIKit`-[UIWebBrowserView resignFirstResponder] + 124
frame #7: 0x30072504 UIKit`-[UIView(Hierarchy) _willMoveToWindow:] + 660
frame #8: 0x30072d74 UIKit`__85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 76
frame #9: 0x30072ca2 UIKit`-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 378
frame #10: 0x30072d94 UIKit`__85-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]_block_invoke + 108
frame #11: 0x30072ca2 UIKit`-[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 378
frame #12: 0x3007fb9a UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 418
frame #13: 0x3014490c UIKit`-[UITableViewCell _addSubview:positioned:relativeTo:] + 88
frame #14: 0x3007f9f2 UIKit`-[UIView(Hierarchy) addSubview:] + 30
frame #15: 0x00068b2e 4399Games1.0`-[SJGameDetailController tableView:cellForRowAtIndexPath:](self=0x162c8e00, _cmd=0x3065c3d7, tableView=0x163b0c00, indexPath=0x19172ab0) + 6478 at SJGameDetailController.m:1515
frame #16: 0x301a6314 UIKit`-[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 408
frame #17: 0x3014e6cc UIKit`-[UITableView _updateVisibleCellsNow:] + 1800
frame #18: 0x3014def0 UIKit`-[UITableView layoutSubviews] + 184
frame #19: 0x30074352 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 346
frame #20: 0x2fcfa942 QuartzCore`-[CALayer layoutSublayers] + 142
frame #21: 0x2fcf6166 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 350
frame #22: 0x2fcf5ff8 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
frame #23: 0x2fcf5a0c QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 228
frame #24: 0x2fcf581e QuartzCore`CA::Transaction::commit() + 314
frame #25: 0x2fcef54c QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
frame #26: 0x2d8baf68 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
frame #27: 0x2d8b88f6 CoreFoundation`__CFRunLoopDoObservers + 286
frame #28: 0x2d8b8c42 CoreFoundation`__CFRunLoopRun + 738
frame #29: 0x2d823470 CoreFoundation`CFRunLoopRunSpecific + 524
frame #30: 0x2d823252 CoreFoundation`CFRunLoopRunInMode + 106
frame #31: 0x3255d2ea GraphicsServices`GSEventRunModal + 138
frame #32: 0x300d8844 UIKit`UIApplicationMain + 1136
frame #33: 0x000498c8 4399Games1.0`main(argc=1, argv=0x27dbecfc) + 116 at main.m:16
ios
objective-c
asked on Stack Overflow Nov 19, 2013 by jiaqiang huang

2 Answers

2

Rayfleck is on right track.

When you want to close the keyboard due to a textfield somewhere in your view, use following & let iOS handle the responder chain

[self.view endEditing:YES];

This is really helpful when there is a table in the view and the table has textfields everywhere.

From Apple Doc:

- (BOOL)endEditing:(BOOL)force

Description Causes the view (or one of its embedded text fields) to resign the first responder status. This method looks at the current view and its subview hierarchy for the text field that is currently the first responder. If it finds one, it asks that text field to resign as first responder. If the force parameter is set to YES, the text field is never even asked; it is forced to resign. Parameters
force
Specify YES to force the first responder to resign, regardless of whether it wants to do so. Returns YES if the view resigned the first responder status or NO if it did not.

answered on Stack Overflow Feb 25, 2014 by Gamma-Point • edited Sep 17, 2014 by Mazyod
1

I had the exact same problem with a UITextField. When I replaced

[myTextField resignFirstResponder];

with

[myTextField endEditing:YES];

the crashes stopped.

answered on Stack Overflow Nov 27, 2013 by Rayfleck

User contributions licensed under CC BY-SA 3.0