iOS 8.3 Keyboard notification not working

567 Views Asked by At

This is the code for keyboard notification i have written.The following code works fine with iOS 8.1 SDK.But the notification for keyboardWasShown: and keyboardWillBeHidden: is not received in iOS 8.3 device.Is there some issue with iOS 8.3 sdk?

- (void)registerForKeyboardNotifications {

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWasShown:)
                                                 name:UIKeyboardWillShowNotification object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillBeHidden:)
                                                 name:UIKeyboardWillHideNotification object:nil];

}

- (void)keyboardWasShown:(NSNotification*)aNotification {
}


- (void)keyboardWillBeHidden:(NSNotification*)aNotification{
}
2

There are 2 best solutions below

0
vijithdaniel On BEST ANSWER

The problem was with the keyboard in iOS 8.3. Uncheck the Predictive and Split keyboard from the Keyboard settings and the notifications works fine.

3
Ankit Sachan On

checked it in 8.4 and it is working fine just check if registerForKeyboardNotifications method is getting called or not