AutoFill issue on iOS for getting phone numbers from the Contacts app

In WWDC2020, a new feature was introduced in which the app can get Contact AutoFill by setting the Content Type of a UITextFiled.

This feature works on iOS 14.5 when the Content Type is set to email address but doesn't work for phone number.

Here's the two changes I'm making in my code:

textField.keyboardType = .phonePad
textField.textContentType = .telephoneNumber

Is there anything else that needs to be done or this is a known bug.

Any updates. Encountered same bug.

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool

just return empty replacementString string.

You need to use the default keyboard and type in the contact's name in order for it it show up on the autofill.

textField.keyboardType = .default
textField.textContentType = .telephoneNumber

textField.keyboardType = .phonePad textField.textContentType = .telephoneNumber

did't work . Seriously?

textField.keyboardType = .numbersAndPunctuation textField.textContentType = .telephoneNumber

works. Seriously?

AutoFill issue on iOS for getting phone numbers from the Contacts app
 
 
Q