I have a chat application that implements a floating text input field (similar to the iOS Messages app) as the inputAccessoryView of my ChatViewController (see Apple's documentation).
class ChatViewController: UIViewController {
override var inputAccessoryView: UIView? {
return chatInputView
}
override var canBecomeFirstResponder: Bool {
return true
}
...
My ChatViewController has a ChatTableViewController child view controller, which has cells containing UITextFields whose text content is editable. The issue I'm running into is that when the user taps on a cell's UITextField, the inputAccessoryView's UITextView refuses to resign first responder status, which prevents the content in the UITableViewCell from being edited. The following warning is logged in the console:
First responder warning: '<UITextView: 0x7fc041041c00;
frame = ...' rejected resignFirstResponder when being removed from hierarchy
I've tried calling resignFirstResponder and endEditing on the UIInputView and UITextView directly with no success. I don't want the ChatViewController to resign first responder status as that would cause the inputAccessoryView to disappear.
Edit: I also receive the warning when dismissing the keyboard interactively (instead of tapping on the UITableViewCell's UITextField.
Could you please check the following:
UITextView is removed from super view:UITextView being removed from the view hierarchy ?resignFirstResponder before removing it from the super view.UITextView subclass is being used:UITextView, if so have you implemented canResignFirstResponder to return false.true instead.This warning is also shown when using the iOS message app and whatsApp. There is no known way to get rid of that. It has no negative impact, I believe we should just ignore it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With