AutoFill username and password in iOS 12
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.