Keyboard height notification inconsistent when toggling software keyboard

Originator:jay.whitsitt
Number:rdar://25193835 Date Originated:3/16/2016
Status:Open Resolved:
Product:iOS Product Version:9.2
Classification: Reproducible:Always
 
Summary:
When listening for UIKeyboardWillShowNotification notifications, the keyboard frame found in the userInfo dictionary with key UIKeyboardFrameEndUserInfoKey is inconsistent when toggling the software keyboard from show to hide. It works fine when dismissing the keyboard by calling resignFirstResponder on the active UITextField.

Steps to Reproduce:
Running the app from the attached project:
1. Tap in the text field
2. If the keyboard did not appear because a hardware keyboard is detected, toggle the software keyboard manually

Expected Results:
1. The UIKeyboardWillShowNotification is sent only once because the keyboard is only displaying once, not hiding and displaying.
2. The CGRect given by [[notification.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue] has the height of the keyboard and is consistent.

Actual Results:
1. The UIKeyboardWillShowNotification notification is received twice even though UIKeyboardWillHideNotification notification is not received in between those two notifications.
2. The height of the keyboard found in the CGRect [[notification.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue] is different both times the notification is received. One of the values is the value expected, but the other is consistently less.

The notification is only received once when hiding the keyboard by resignFirstResponder and the value received for the end keyboard height is as expected.

Version:
iOS 8.4 and 9.2

Notes:


Configuration:
Tested on iPhone 5s and 6 Simulators (not able to test on a device without bluetooth keyboard hardware) running in Xcode 7.2.1 on OSX 10.11.3

Attachments:
'Keyboard Height Test.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!