InputBarAccessoryView icon indicating copy to clipboard operation
InputBarAccessoryView copied to clipboard

iOS 14.2: rejected resignFirstResponder when being removed from hierarchy

Open mschonvogel opened this issue 4 years ago • 6 comments

Example[44229:872073] [View] First responder warning: '<InputBarAccessoryView.InputTextView: 0x7fb27d02ca00; baseClass = UITextView; frame = (0 0; 291 38); text = ''; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x6000013b6b80>; layer = <CALayer: 0x600001d96e40>; contentOffset: {0, 0}; contentSize: {142.5, 36.5}; adjustedContentInset: {0, 0, 0, 0}>' rejected resignFirstResponder when being removed from hierarchy

To Reproduce

  1. Open the Example app and pick any example in the InputAccessoryView section
  2. Tap into textfield
  3. Slide it down to end editing

Expected behavior resignFirstResponder and hence keyboardManager.on(event: .willHide) should get called (it's getting called in Simulator but not on a real device (tried it with iPhone 11 pro)

I think it's a bug in iOS 14.2 https://openradar.appspot.com/FB8832021

Environment 5.2.2 - Example app

mschonvogel avatar Nov 13 '20 20:11 mschonvogel

Yep, same here. If I call resignFirstResponder() in viewWillDisappear() the willHide notification gets fired as intended. When resignFirstResponder() called in other methods the notification does not work. Have tested in both 14.2 and 14.3

acydapp avatar Dec 17 '20 20:12 acydapp

Thank for letting us know it's probably an iOS thing!

Kaspik avatar Dec 21 '20 09:12 Kaspik

Any workarounds? @Kaspik @mschonvogel @acydapp

Ludotrico avatar Jan 04 '21 20:01 Ludotrico

Any workarounds? @Kaspik @mschonvogel @acydapp

Got this solution from @mschonvogel and it works for my case: try textview's didEndEditing method

acydapp avatar Jan 14 '21 09:01 acydapp

@acydapp hi, can u explain more, thanks

fukemy avatar Mar 12 '21 12:03 fukemy

This is not an issue anymore, is it @mschonvogel ?

Kaspik avatar Feb 03 '22 11:02 Kaspik