Phone number suggestions don't work

Originator:alexandr.nikishin
Number:rdar://7358804 Date Originated:08/10/2019
Status:Potential fix identified - For a future OS update Resolved:
Product: Product Version:
Classification: Reproducible:
 
UITextField configured to input phone numbers(digits only) doesn't present suggestions at the top of the keyboard in iOS 13(13.1.2 included), the same text field has suggestions in iOS 12.
Steps to reproduce:
1. Have an UITextField for phone number input. These are the settings, all the rest is kept to default:
self.textField.keyboardType = .phonePad
self.textField.textContentType = .telephoneNumber
2. Make focus on the textfield
3.
Expected behavior:
See suggestions at the top of the keyboard.
Actional result:
No suggestions view

Note: Changing keyboard type to UIKeyboardTypeNamePhonePad brings suggestions back, but it doesn't fit our phone filed's logic, we can't use it as a solution.

Comments

I made a small investigation with Hopper and found interesting stuff. Within [UIPredictionViewController isVisibleForInputDelegate:inputViews:] call there is check against the bitmask 0b100100110000. Each bit in this mask corresponds to a value of UIKeyboardType. Thus predictions are disabled for the following types: UIKeyboardTypeNumberPad UIKeyboardTypePhonePad UIKeyboardTypeDecimalPad UIKeyboardTypeASCIICapableNumberPad Obviously, predictions were disabled for all numerical keyboards and I guess phone pad was added accidentally too. Everything works fine when I swizzle initial function to return "true" in case of phone keyboard, as expected I'm having my phone suggested above the keyboard.

By alexandr.nikishin at March 4, 2020, 3:43 p.m. (reply...)

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!