danielamitay / DAKeyboardControl

DAKeyboardControl adds keyboard awareness and scrolling dismissal (ala iMessages app) to any view with only 1 line of code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hideKeyboard can cause crash in some cases

slycrel opened this issue · comments

We are using a split view controller that has the keyboard on it. If the keyboard is activated and the view with the keyboard is changed (but the keyboard control remains active), when hideKeyboard is called, self.keyboardActiveInput returns a deallocated text edit pointer.

Wrapping the 3 lines in hideKeyboard with:

if (self.keyboardActiveView)
{
...
}

This seems to fix this issue. Not sure if this is the best way to take care of this or if the object that self.keyboardActiveInput returns should be set to nil when "inputKeyboardDidHide" is called or something else.

Thanks for a great drop-in!

Indeed, inputKeyboardDidHide should be setting it to nil, but it's not being called due to the keyboard remaining active... Pushed a quick fix, will look into a more comprehensive fix.

Thanks for the quick update and response. =)