Native UITextField Secure Text Entry forces English (US) keyboard Native UITextField Secure Text Entry forces English (US) keyboard ios ios

Native UITextField Secure Text Entry forces English (US) keyboard


I have the same issue, in my case this bug appears only with a register screen.

The reason is that Apple checks the name of the class/func/parameter to determine (with heuristics) if it is a login/register screen and activate automatically autofill password.By replacing "register" with "Patate" in my code, the problem is solved.

I reproduce this issue with a sample app with 2 textfields (with a security text entry) and a view controller named "RegisterViewController". With a "PatateViewController", I have not the issue.

Moreover, I have this error in console :[AutoFill] Cannot show Automatic Strong Passwords for app bundleID: *** due to error: iCloud Keychain is disabled

Source : https://developer.apple.com/documentation/security/password_autofill

Hope you will find a better way than renaming your code.


I had the same problem appear recently on our application.The problem is linked to the new feature of the PasswordAutofill from Apple.

To bypass this problem you can apply this little piece of code on your secure textfield

    if #available(iOS 12.0, *) {        tfPassword.textContentType = .oneTimeCode    }

This should resolve this bug.This should also fix this error:

[AutoFill] Cannot show Automatic Strong Passwords for app bundleID: *** due to error: iCloud Keychain is disabled

Ps: You could also add this new feature to your app.This is a link to an article explaining the process on how to implement this new feature Explanation on how to implement password autofill

Hope it helps.


Same solution in Swiftui now :

TextField("placeholder",text: $YourTextBinding)                        .textContentType(.oneTimeCode)                        .keyboardType(.default)

just need to add :

                        .textContentType(.oneTimeCode)                        .keyboardType(.default)

to a TextField or a SecureField.

hope it helps !


matomo