Messagekit: First responder warning: rejected resignFirstResponder when being removed from hierarchy

Created on 2 Nov 2017  路  1Comment  路  Source: MessageKit/MessageKit

General Information

  • MessageKit Version: 0.1.0

  • iOS Version(s): 10.3.2

  • Swift Version: 4

  • Devices/Simulators: iPhone6s Simulator

  • Reproducible in ChatExample? (Yes/No): No

What happened?

When I go to ChatViewController and come back to previous ViewController, the input bar at the bottom is still available with the following warning/error message

[View] First responder warning: '<MessageKit.InputTextView: 0x7fcf6689ea00; baseClass = UITextView; frame = (12 6; 291 30); text = ''; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x60000064ff30>; layer = <CALayer: 0x600000628fc0>; contentOffset: {0, 0}; contentSize: {0, 28.5}; adjustedContentInset: {0, 0, 0, 0}>' rejected resignFirstResponder when being removed from hierarchy
2017-11-02 18:15:48.045937+0530 KMIAPP[13223:141996] [Snapshotting] Snapshotting a view (0x7fcf66025600, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.

What did you expect to happen?

The Input Bar must be removed once I navigate away from ChatViewController. I am not sure what is causing this. I am using IQKeyboardManager and I tried disabling it. The problem still exist.

question

Most helpful comment

Upon further testing, this issue is a conflict with IQKeyboardManager and related to #309

The solution to this issue is to disable IQKeyboardManager in the viewDidDisappear() instead of viewWillDisappear() here is the code for reference.

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    IQKeyboardManager.sharedManager().enable = false
}

override func viewDidDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)
    IQKeyboardManager.sharedManager().enable = true
}

Since this remains solved. I am closing this issue.

>All comments

Upon further testing, this issue is a conflict with IQKeyboardManager and related to #309

The solution to this issue is to disable IQKeyboardManager in the viewDidDisappear() instead of viewWillDisappear() here is the code for reference.

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    IQKeyboardManager.sharedManager().enable = false
}

override func viewDidDisappear(_ animated: Bool) {
    super.viewDidDisappear(animated)
    IQKeyboardManager.sharedManager().enable = true
}

Since this remains solved. I am closing this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheDarkCode picture TheDarkCode  路  3Comments

Abacaxi-Nelson picture Abacaxi-Nelson  路  4Comments

mlequeux picture mlequeux  路  3Comments

NiklasWilson picture NiklasWilson  路  4Comments

omaralbeik picture omaralbeik  路  4Comments