I implemented AutoFill for stored username and password suggestion successfully in iOS 11.
I have two text fields in my login view controller, one for email, one for password. The content types are defined as follows:
email / username text field configuration
password text field configuration
This used to work just fine in iOS 11, but after upgrading my development iPad to iOS 12, the app suggests emails for the username field and the following happens when editing the password field:
In my create account view controller, I have 3 text fields: email, password, repeat password. Their content modes are setup as follows:
minlength:8;
minlength:8;
When editing the email address field, it properly suggests an email address. For the password and repeat password fields, however, it suggests stored passwords, instead of suggesting a new password.
new password
and the create account password fields are set to password
none
for login and create account fields so AutoFill can try to handle it automatically
Any idea what I need to change so that stored username & password suggestion works in iOS 12 again?
Thanks!
As requested by @kralex below, here's my view hierarchy for the login view controller in the storyboard:
...and on the device:
Apple is doing some heuristic to make the best guess what you might need: autofill or a new password. However in some cases it might fail.
In your case the problem is related to the "Create Account Button". It makes the system think that it is a sign up form.
The easiest option to fix it: replace sign up UIButton with UILabel and add tapRecognizer to handle taps.
I had a similar issue and found out Apple's heuristics were tapping in to the class name of the view controller to determine whether to suggest a new password or use an existing one. It seems like even if I set the correct textContentType
on my UITextField
s, it still would use the name of the controller.
My UIViewController
has both sign up and login on the same screen, but the controller is named RegistrationViewController
. I changed it to LoginViewController
to test, and found that the login portion started working, but the registration bit acted like it was login! Even with the correct textContentType
s set!
I wound up having to rename my UIViewController
something that doesn't imply registration or login for it to actually respect my textContentType
s. It's awful. Truly awful.
I would imagine at least part of the reason this is/was happening to you is because the you have the word Welcome
as the beginning of your view controller, unbelievable as it sounds.
By the way, I tried RegistrationLoginViewController
(it chose the registration setup) and LoginRegistrationViewController
(it chose the login setup), and neither worked. It has to avoid Apple's heuristics if you want to have both on the same controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With