Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 11 disable password autofill accessory view option?

Tags:

ios

swift

ios11

As of now I would like to opt out of the new option iOS 11 gives, that is to suggest passwords in the app. When I run the app on iOS 11 I get the autofill option on top of the keyboard and my username and password textfield don't even show up.

So, my question is, how can I disable the new password autofill feature all together so the key on the keyboard is not shown at all and the overall behavior is the same as pre iOS 11?

enter image description here

like image 466
zumzum Avatar asked Aug 02 '17 05:08

zumzum


People also ask

How do I turn off AutoFill password on iPhone?

Prevent iPhone from automatically filling in passwordsGo to Settings > Passwords > AutoFill Passwords, then turn off AutoFill Passwords.

How do I turn off Safari password suggestions?

Safari. Click the Safari menu and choose Preferences. Click the AutoFill icon. Turn off all the AutoFill settings: “Using info from my contacts,” “User names and passwords,” “Credit cards,” and “Other forms.”


1 Answers

iOS 11 & 12 & 13 - Swift 4.2 & 5 (Updated):

if #available(iOS 12, *) {     // iOS 12 & 13: Not the best solution, but it works.     passwordTextField.textContentType = .oneTimeCode } else {     // iOS 11: Disables the autofill accessory view.      // For more information see the explanation below.     emailTextField.textContentType = .init(rawValue: "")     passwordTextField.textContentType = .init(rawValue: "") } 

iOS 11 explanation:

Make sure you setup all of your UITextField objects like this.

If you have for example an UITextField object where the user must enter his email address and another one where the user must enter his password assign UITextContentType("") to both of their textContentType property. Otherwise it will not work and the autoFill accessory view will still be shown.

like image 170
Baran Emre Avatar answered Sep 25 '22 05:09

Baran Emre