From d3fade273f8da3064ef289ea97b78a336bacffbb Mon Sep 17 00:00:00 2001 From: James Robert Perih Date: Tue, 26 Jul 2016 16:08:52 -0500 Subject: [PATCH] Update DAKeyboardControl.m Fixes an issue where we attempt to get self.keyboardACtiveInput.inputAccessoryView, but the target doesn't respond to this request, resulting in a crash. --- DAKeyboardControl/DAKeyboardControl.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/DAKeyboardControl/DAKeyboardControl.m b/DAKeyboardControl/DAKeyboardControl.m index c629ca46..fab53fd6 100644 --- a/DAKeyboardControl/DAKeyboardControl.m +++ b/DAKeyboardControl/DAKeyboardControl.m @@ -275,7 +275,16 @@ - (void)inputKeyboardWillShow:(NSNotification *)notification - (void)inputKeyboardDidShow { - // Grab the keyboard view + // Grab the keyboard view if we have access to it + if ([self.keyboardActiveInput respondsToSelector:@selector(inputAccessoryView)]) { + self.keyboardActiveView = self.keyboardActiveInput.inputAccessoryView.superview; + } + + // get out of dodge if we couldn't get the instance + if (!self.keyboardActiveView) { + return; + } + self.keyboardActiveView = self.keyboardActiveInput.inputAccessoryView.superview; self.keyboardActiveView.hidden = NO; @@ -747,4 +756,4 @@ - (BOOL)keyboardWillRecede return touchLocationInKeyboardWindow.y >= thresholdHeight && velocity.y >= 0; } -@end \ No newline at end of file +@end