iOS 11 disable password autofill accessory view option?2019 Community Moderator ElectionObjective-C Disable AutoFill Password for UITextFieldiOS 8 - How to hide suggestion list above keyboard?How to hide inputAccessoryView without dismissing keyboardHow to disable new password Autofill feature in iOS 11 applications login screen?Set a PasswordField to secureTextEntry give me a strange behaviourReact Native - Disable Password AutoFill Option on iOS KeyboardiOS Passwords autofill accessory view makes app get stuckGetting strong password on not necessary field in iOS 12How to hide icon and text password above keyboard in iphone 6s and 5sHow can I disable the UITableView selection?iPad keyboard will not dismiss if modal ViewController presentation style is UIModalPresentationFormSheetPassing Data between View Controllerspassword autofill quicktype bar in ios 11iOS 11 AutoFill password feature doesn't work with other language than English languageHow to disable new password Autofill feature in iOS 11 applications in Hybrid Phonegap Apps?WKWebview Password API Autofill

Describing a chess game in a novel

Happy pi day, everyone!

Is "upgrade" the right word to use in this context?

A diagram about partial derivatives of f(x,y)

Violin - Can double stops be played when the strings are not next to each other?

Different outputs for `w`, `who`, `whoami` and `id`

How to pronounce "I ♥ Huckabees"?

ERC721: How to get the owned tokens of an address

How could an airship be repaired midflight?

Meme-controlled people

Does .bashrc contain syntax errors?

Brexit - No Deal Rejection

Does multi-classing into Fighter give you heavy armor proficiency?

et qui - how do you really understand that kind of phraseology?

Why do newer 737s use two different styles of split winglets?

What is "focus distance lower/upper" and how is it different from depth of field?

Why does overlay work only on the first tcolorbox?

What did “the good wine” (τὸν καλὸν οἶνον) mean in John 2:10?

Relationship between sampajanna definitions in SN 47.2 and SN 47.35

Why is the President allowed to veto a cancellation of emergency powers?

Adventure Game (text based) in C++

PTIJ: Who should I vote for? (21st Knesset Edition)

What are substitutions for coconut in curry?

Is there a place to find the pricing for things not mentioned in the PHB? (non-magical)



iOS 11 disable password autofill accessory view option?



2019 Community Moderator ElectionObjective-C Disable AutoFill Password for UITextFieldiOS 8 - How to hide suggestion list above keyboard?How to hide inputAccessoryView without dismissing keyboardHow to disable new password Autofill feature in iOS 11 applications login screen?Set a PasswordField to secureTextEntry give me a strange behaviourReact Native - Disable Password AutoFill Option on iOS KeyboardiOS Passwords autofill accessory view makes app get stuckGetting strong password on not necessary field in iOS 12How to hide icon and text password above keyboard in iphone 6s and 5sHow can I disable the UITableView selection?iPad keyboard will not dismiss if modal ViewController presentation style is UIModalPresentationFormSheetPassing Data between View Controllerspassword autofill quicktype bar in ios 11iOS 11 AutoFill password feature doesn't work with other language than English languageHow to disable new password Autofill feature in iOS 11 applications in Hybrid Phonegap Apps?WKWebview Password API Autofill










59















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










share|improve this question






















  • Try setting the username and password field's textContentType property to .textContentType - This should tell iOS 11 that your fields aren't username/password fields (even though they are) and prevent the accessory view being displayed; Something like ` self.passwordField.textContentType = .textContentType`

    – Paulw11
    Aug 2 '17 at 5:51











  • @zumzum did you get any solution . please share

    – Nazmul Hasan
    Aug 10 '17 at 19:57






  • 2





    This is a problem for me as well. The autocomplete feature appears on the fields for signing up, which isn't desired. I'd like them just to be on the fields for logging in. Strange stuff.

    – Brad Root
    Sep 7 '17 at 2:11






  • 2





    Looks like on iOS12 it appears again. How did you solve it there?

    – dollar2048
    Aug 1 '18 at 9:09











  • In iOS12, it still appears. Do you have any idea ?

    – Emrah Akgül
    Aug 8 '18 at 13:55















59















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










share|improve this question






















  • Try setting the username and password field's textContentType property to .textContentType - This should tell iOS 11 that your fields aren't username/password fields (even though they are) and prevent the accessory view being displayed; Something like ` self.passwordField.textContentType = .textContentType`

    – Paulw11
    Aug 2 '17 at 5:51











  • @zumzum did you get any solution . please share

    – Nazmul Hasan
    Aug 10 '17 at 19:57






  • 2





    This is a problem for me as well. The autocomplete feature appears on the fields for signing up, which isn't desired. I'd like them just to be on the fields for logging in. Strange stuff.

    – Brad Root
    Sep 7 '17 at 2:11






  • 2





    Looks like on iOS12 it appears again. How did you solve it there?

    – dollar2048
    Aug 1 '18 at 9:09











  • In iOS12, it still appears. Do you have any idea ?

    – Emrah Akgül
    Aug 8 '18 at 13:55













59












59








59


16






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










share|improve this question














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







ios swift ios11






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 2 '17 at 5:28









zumzumzumzum

5,388126799




5,388126799












  • Try setting the username and password field's textContentType property to .textContentType - This should tell iOS 11 that your fields aren't username/password fields (even though they are) and prevent the accessory view being displayed; Something like ` self.passwordField.textContentType = .textContentType`

    – Paulw11
    Aug 2 '17 at 5:51











  • @zumzum did you get any solution . please share

    – Nazmul Hasan
    Aug 10 '17 at 19:57






  • 2





    This is a problem for me as well. The autocomplete feature appears on the fields for signing up, which isn't desired. I'd like them just to be on the fields for logging in. Strange stuff.

    – Brad Root
    Sep 7 '17 at 2:11






  • 2





    Looks like on iOS12 it appears again. How did you solve it there?

    – dollar2048
    Aug 1 '18 at 9:09











  • In iOS12, it still appears. Do you have any idea ?

    – Emrah Akgül
    Aug 8 '18 at 13:55

















  • Try setting the username and password field's textContentType property to .textContentType - This should tell iOS 11 that your fields aren't username/password fields (even though they are) and prevent the accessory view being displayed; Something like ` self.passwordField.textContentType = .textContentType`

    – Paulw11
    Aug 2 '17 at 5:51











  • @zumzum did you get any solution . please share

    – Nazmul Hasan
    Aug 10 '17 at 19:57






  • 2





    This is a problem for me as well. The autocomplete feature appears on the fields for signing up, which isn't desired. I'd like them just to be on the fields for logging in. Strange stuff.

    – Brad Root
    Sep 7 '17 at 2:11






  • 2





    Looks like on iOS12 it appears again. How did you solve it there?

    – dollar2048
    Aug 1 '18 at 9:09











  • In iOS12, it still appears. Do you have any idea ?

    – Emrah Akgül
    Aug 8 '18 at 13:55
















Try setting the username and password field's textContentType property to .textContentType - This should tell iOS 11 that your fields aren't username/password fields (even though they are) and prevent the accessory view being displayed; Something like ` self.passwordField.textContentType = .textContentType`

– Paulw11
Aug 2 '17 at 5:51





Try setting the username and password field's textContentType property to .textContentType - This should tell iOS 11 that your fields aren't username/password fields (even though they are) and prevent the accessory view being displayed; Something like ` self.passwordField.textContentType = .textContentType`

– Paulw11
Aug 2 '17 at 5:51













@zumzum did you get any solution . please share

– Nazmul Hasan
Aug 10 '17 at 19:57





@zumzum did you get any solution . please share

– Nazmul Hasan
Aug 10 '17 at 19:57




2




2





This is a problem for me as well. The autocomplete feature appears on the fields for signing up, which isn't desired. I'd like them just to be on the fields for logging in. Strange stuff.

– Brad Root
Sep 7 '17 at 2:11





This is a problem for me as well. The autocomplete feature appears on the fields for signing up, which isn't desired. I'd like them just to be on the fields for logging in. Strange stuff.

– Brad Root
Sep 7 '17 at 2:11




2




2





Looks like on iOS12 it appears again. How did you solve it there?

– dollar2048
Aug 1 '18 at 9:09





Looks like on iOS12 it appears again. How did you solve it there?

– dollar2048
Aug 1 '18 at 9:09













In iOS12, it still appears. Do you have any idea ?

– Emrah Akgül
Aug 8 '18 at 13:55





In iOS12, it still appears. Do you have any idea ?

– Emrah Akgül
Aug 8 '18 at 13:55












14 Answers
14






active

oldest

votes


















48














iOS 11 & 12 - Swift 4.2 (Updated):



 if #available(iOS 12, *) 
// iOS 12: 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.






share|improve this answer




















  • 1





    It's available form iOS 10, not iOS 11.

    – matm
    Mar 12 '18 at 11:30











  • @matm you are right. Edited the answer. Thanks.

    – Bem
    Mar 14 '18 at 8:30






  • 3





    not working for iOS 12... Any solutions?

    – Gal Shahar
    Sep 20 '18 at 10:33











  • @GalShahar I can't test it right now but here is my suggestion: iOS 12 introduces a new UITextContentType which is called newPassword (see: developer.apple.com/documentation/uikit/uitextcontenttype/…). Try setting the password text fields content type to this type. I guess iOS will not show the autofill accessory view then, because the user is forced to setup a new password and not use/access one that was setup before by using the autofill accessory view. Right now this is only theory. I'm not sure whether this will work, but let me know whether it does!

    – Bem
    Sep 21 '18 at 11:50






  • 1





    This works great on iOS 12 for me

    – Zach
    Oct 22 '18 at 23:56


















8














The feature can be disabled by specifying a content type that is neither username nor password. For example, if the user should enter an email address, you could use



usernameTextField?.textContentType = .emailAddress





share|improve this answer


















  • 1





    Interestingly I have an email address field above a password field, and the email address field offers an auto-complete.

    – Brad Root
    Sep 7 '17 at 2:10











  • @BradRoot change your password field textContentype too! if your email is already saved in keychain then it will show the info in quickbar, so better to user .nickname or try this code if #available(iOS 10.0, *) self.passwordTextField.textContentType = UITextContentType.init(rawValue: "") else // Fallback on earlier versions

    – Sahil
    Sep 28 '17 at 5:48



















8














iOS 12 seems to recognise password textFields also by isSecureTextEntry property and not just by textContentType property, so making this accessory view disappear is not really possible unless you both set textContentType to nothing, and remove the secureEntry feature (and cause a security flaw in your app) which then prevents iOS 12 to recognise the textField as a password textField and show this annoying accessory view.



In my case the accessory caused a bug which made my app unresponsive when tapped (Which also got my app rejected in app review process). So I had to remove this feature. I didn't want to give on up this security feature so I had to solve things by my self.



The idea is to remove the secureEntry feature but add it by yourself manually. It did worked:



enter image description here




It can be done like that:



Swift 4 way:



First, as answered here, set textContentType to nothing:



if #available(iOS 10.0, *) 
passwordText.textContentType = UITextContentType("")
emailText.textContentType = UITextContentType("")



Than, declare a String variable which will later contain our textField real content:



var passwordValue = ""



Add a target to the passwordTextField, which will be called each time the textField content changes:



passwordText.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)


Now That's what will do the magic, declare the function that will handle the text replacements:



@objc func textFieldDidChange(_ textField: UITextField) 
if textField.text!.count > 1
// User did copy & paste
if passwordValue.count == 0 // Pasted into an empty textField
passwordValue = String(textField.text!)
else // Pasted to a non empty textField
passwordValue += textField.text!.substring(from: passwordValue.count)

else
// User did input by keypad
if textField.text!.count > passwordValue.count // Added chars
passwordValue += String(textField.text!.last!)
else if textField.text!.count < passwordValue.count // Removed chars
passwordValue = String(passwordValue.dropLast())


self.passwordText.text = String(repeating: "•", count: self.passwordText.text!.count)



Finally, Set textField's autocorrectionType to .no to remove predictive text:



passwordText.autocorrectionType = .no


That's it, use passwordValue to perform your login.



Hope it'll help someone.



UPDATE



It catches pasted values also, forgot to add it before.






share|improve this answer




















  • 1





    Super! Nice hack buddy! shame that iOS makes us hack rather than providing cleaner ways to do the most basic things. This should be the accepted answer.

    – Josh
    Sep 24 '18 at 12:50


















7














You can add extension for UITextContentType like this



extension UITextContentType 
public static let unspecified = UITextContentType("unspecified")



after that, you can use it



if #available(iOS 10.0, *) 
passwordField.textContentType = .unspecified






share|improve this answer






























    6














    A very simple approach in ios11 worked for me. Suppose your iboutlets are usernametextfield and passwordtextfield. In viewDidLoad() function of your viewcontroller that holds the both outlest use the following code



    usernametextfield.textContentType = UITextContentType("")
    passwordtextfield.textContentType = UITextContentType("")


    After this you wont see autofill accessory option when you tap on your textfields.






    share|improve this answer






























      5














      Objective-C



      if (@available(iOS 10, *))
      self.tfEmail.textContentType = @"";
      self.tfPassword.textContentType = @"";



      This worked for me.






      share|improve this answer






























        3














        Autofill is by default enabled for users. iOS saves all passwords in the keychain and make them available in keyboard in your apps. UITextView and UITextField automatically considered for AutoFill password. you can disable by specifying a content type that is neither username nor password but if the content type info already stored in keychain it will show in the quick bar. so better to assign empty UITextContentType type and it will not show quickbar.



        Example:



         if #available(iOS 10.0, *) 
        self.textField.textContentType = UITextContentType("")
        else
        // Fallback on earlier versions






        share|improve this answer
































          2














          Objective C version:



          if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) 
          self.passwordTextField.textContentType = @"";
          self.confirmPasswordTextField.textContentType = @"";



          where



          #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
          #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
          #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
          #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
          #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)





          share|improve this answer






























            1














            You could try different answers here that conclude its likely possible to remove accessoryview. But this leaves some bugs.



            How to hide inputAccessoryView without dismissing keyboard



            You could try to implement a custom keyboard perhaps, only for password fields. Also try to disable suggestions for your textfield, i think that also hides the accessoryView.



            EDIT:
            No answer on apple forums on same question as of yet. Also i couldnt find anything regarding this in official uitextfield documentation.



            https://forums.developer.apple.com/thread/82442






            share|improve this answer
































              1














              You can "turn off" the username/password combo detection by assigning a dummy textContentType to the password text field.



              passwordFormField.textContentType = UITextContentType("dummy")


              This turned off the key symbol for both the password field and the email field that preceded it, and in this way you don't use one of the predefined values and you avoid showing unrelated suggestions in the keyboard accessory view.






              share|improve this answer























              • Does this still work on the latest iOS 12 beta for you?

                – pfandrade
                Aug 9 '18 at 11:22











              • No it does not. On iOS 12 it detects this field as a new password field and suggests a new strong password (new iOS 12 feature). I actually want this behavior in my case, so I'm tagging this password field with the new iOS 12 newPassword UITextContentType . I don't know how to avoid this new behavior though.

                – Miguel Cabeça
                Aug 20 '18 at 7:28











              • For iOS 12 beta, if use: textContentType = UITextContentType.oneTimeCode. Then, it doesn't have the keychain on the keyboard. It seems to work fine for me without any side effects. If you use .newPassword, that also works, but then it asks you to save the password once you finish with the password.

                – Daniel Jones
                Sep 5 '18 at 21:22


















              1














              self.passwordTextField.autocorrectionType = NO;


              It does not seem to work, the keychain sign still there,



              self.passwordTextField.textContentType = UITextContentTypeName;


              The code above does work, but if the users set up their Apple ID account, Then, the name of the apple id will be display on the keyboard you cannot disable it by set autocorrectionType to No, not sure if Apple still refines this autofill feature, it's quite buggy right now.






              share|improve this answer

























              • This type of 'answer' should be reserved for the comments section, as it doesn't give an actual answer or link to any reference documentation from apple etc. Welcome to SO though!

                – stktrc
                Aug 4 '17 at 4:00











              • no solution yet. Nothing listed here worked well for me.

                – zumzum
                Aug 15 '17 at 16:46


















              1














              This worked for ios 12 and 10:



              if (@available(iOS 10, *)) 
              passwordTextField.textContentType = UITextContentTypeStreetAddressLine2;


              if (@available(iOS 12, *))
              passwordTextField.textContentType = UITextContentTypeOneTimeCode;






              share|improve this answer
































                0














                in response to @Gal Shahar Answer.



                iOS 12 recognise password textFields by isSecureTextEntry property and not just by textContentType property.



                Way Around to bypass Auto-fill Suggestion.



                1. set isSecureTextEntry property to false.

                self.passwordTextField.secureTextEntry = NO;



                1. Add a UITextField Delegate Method and enable the isSecureTextEntry property.

                - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
                if (textField == self.passwordTextField && !self.passwordTextField.secureTextEntry)
                self.passwordTextField.secureTextEntry = YES;


                return YES;



                NOTE: -
                Do NOT Use shouldBeginEditing UITextField delegate method it Will Still show Auto-filling Suggestion.
                Do NOT Use textFieldDidChange UITextField delegate method it Will Auto-delete the first charachter as the it Will happen after the first charachter is displayed. And 'secureTextEntry' will empty the field.






                share|improve this answer






























                  -1














                  This worked for me:



                  NOTE: try putting this code on the password, password confirm (if applicable), AND email textfields. I was not putting it on the email textfield and it was still popping up for the two password fields.



                  if #available(iOS 12, *) 
                  // iOS 12: Not the best solution, but it works.
                  cell.textField.textContentType = .oneTimeCode
                  else
                  // iOS 11: Disables the autofill accessory view.
                  cell.textField.textContentType = .init(rawValue: "")






                  share|improve this answer























                  • This is the same as Bem’s answer.

                    – ayaio
                    Feb 1 at 19:03










                  Your Answer






                  StackExchange.ifUsing("editor", function ()
                  StackExchange.using("externalEditor", function ()
                  StackExchange.using("snippets", function ()
                  StackExchange.snippets.init();
                  );
                  );
                  , "code-snippets");

                  StackExchange.ready(function()
                  var channelOptions =
                  tags: "".split(" "),
                  id: "1"
                  ;
                  initTagRenderer("".split(" "), "".split(" "), channelOptions);

                  StackExchange.using("externalEditor", function()
                  // Have to fire editor after snippets, if snippets enabled
                  if (StackExchange.settings.snippets.snippetsEnabled)
                  StackExchange.using("snippets", function()
                  createEditor();
                  );

                  else
                  createEditor();

                  );

                  function createEditor()
                  StackExchange.prepareEditor(
                  heartbeatType: 'answer',
                  autoActivateHeartbeat: false,
                  convertImagesToLinks: true,
                  noModals: true,
                  showLowRepImageUploadWarning: true,
                  reputationToPostImages: 10,
                  bindNavPrevention: true,
                  postfix: "",
                  imageUploader:
                  brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                  contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                  allowUrls: true
                  ,
                  onDemand: true,
                  discardSelector: ".discard-answer"
                  ,immediatelyShowMarkdownHelp:true
                  );



                  );













                  draft saved

                  draft discarded


















                  StackExchange.ready(
                  function ()
                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45452170%2fios-11-disable-password-autofill-accessory-view-option%23new-answer', 'question_page');

                  );

                  Post as a guest















                  Required, but never shown

























                  14 Answers
                  14






                  active

                  oldest

                  votes








                  14 Answers
                  14






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  48














                  iOS 11 & 12 - Swift 4.2 (Updated):



                   if #available(iOS 12, *) 
                  // iOS 12: 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.






                  share|improve this answer




















                  • 1





                    It's available form iOS 10, not iOS 11.

                    – matm
                    Mar 12 '18 at 11:30











                  • @matm you are right. Edited the answer. Thanks.

                    – Bem
                    Mar 14 '18 at 8:30






                  • 3





                    not working for iOS 12... Any solutions?

                    – Gal Shahar
                    Sep 20 '18 at 10:33











                  • @GalShahar I can't test it right now but here is my suggestion: iOS 12 introduces a new UITextContentType which is called newPassword (see: developer.apple.com/documentation/uikit/uitextcontenttype/…). Try setting the password text fields content type to this type. I guess iOS will not show the autofill accessory view then, because the user is forced to setup a new password and not use/access one that was setup before by using the autofill accessory view. Right now this is only theory. I'm not sure whether this will work, but let me know whether it does!

                    – Bem
                    Sep 21 '18 at 11:50






                  • 1





                    This works great on iOS 12 for me

                    – Zach
                    Oct 22 '18 at 23:56















                  48














                  iOS 11 & 12 - Swift 4.2 (Updated):



                   if #available(iOS 12, *) 
                  // iOS 12: 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.






                  share|improve this answer




















                  • 1





                    It's available form iOS 10, not iOS 11.

                    – matm
                    Mar 12 '18 at 11:30











                  • @matm you are right. Edited the answer. Thanks.

                    – Bem
                    Mar 14 '18 at 8:30






                  • 3





                    not working for iOS 12... Any solutions?

                    – Gal Shahar
                    Sep 20 '18 at 10:33











                  • @GalShahar I can't test it right now but here is my suggestion: iOS 12 introduces a new UITextContentType which is called newPassword (see: developer.apple.com/documentation/uikit/uitextcontenttype/…). Try setting the password text fields content type to this type. I guess iOS will not show the autofill accessory view then, because the user is forced to setup a new password and not use/access one that was setup before by using the autofill accessory view. Right now this is only theory. I'm not sure whether this will work, but let me know whether it does!

                    – Bem
                    Sep 21 '18 at 11:50






                  • 1





                    This works great on iOS 12 for me

                    – Zach
                    Oct 22 '18 at 23:56













                  48












                  48








                  48







                  iOS 11 & 12 - Swift 4.2 (Updated):



                   if #available(iOS 12, *) 
                  // iOS 12: 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.






                  share|improve this answer















                  iOS 11 & 12 - Swift 4.2 (Updated):



                   if #available(iOS 12, *) 
                  // iOS 12: 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.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 1 '18 at 9:11

























                  answered Sep 28 '17 at 16:34









                  BemBem

                  807815




                  807815







                  • 1





                    It's available form iOS 10, not iOS 11.

                    – matm
                    Mar 12 '18 at 11:30











                  • @matm you are right. Edited the answer. Thanks.

                    – Bem
                    Mar 14 '18 at 8:30






                  • 3





                    not working for iOS 12... Any solutions?

                    – Gal Shahar
                    Sep 20 '18 at 10:33











                  • @GalShahar I can't test it right now but here is my suggestion: iOS 12 introduces a new UITextContentType which is called newPassword (see: developer.apple.com/documentation/uikit/uitextcontenttype/…). Try setting the password text fields content type to this type. I guess iOS will not show the autofill accessory view then, because the user is forced to setup a new password and not use/access one that was setup before by using the autofill accessory view. Right now this is only theory. I'm not sure whether this will work, but let me know whether it does!

                    – Bem
                    Sep 21 '18 at 11:50






                  • 1





                    This works great on iOS 12 for me

                    – Zach
                    Oct 22 '18 at 23:56












                  • 1





                    It's available form iOS 10, not iOS 11.

                    – matm
                    Mar 12 '18 at 11:30











                  • @matm you are right. Edited the answer. Thanks.

                    – Bem
                    Mar 14 '18 at 8:30






                  • 3





                    not working for iOS 12... Any solutions?

                    – Gal Shahar
                    Sep 20 '18 at 10:33











                  • @GalShahar I can't test it right now but here is my suggestion: iOS 12 introduces a new UITextContentType which is called newPassword (see: developer.apple.com/documentation/uikit/uitextcontenttype/…). Try setting the password text fields content type to this type. I guess iOS will not show the autofill accessory view then, because the user is forced to setup a new password and not use/access one that was setup before by using the autofill accessory view. Right now this is only theory. I'm not sure whether this will work, but let me know whether it does!

                    – Bem
                    Sep 21 '18 at 11:50






                  • 1





                    This works great on iOS 12 for me

                    – Zach
                    Oct 22 '18 at 23:56







                  1




                  1





                  It's available form iOS 10, not iOS 11.

                  – matm
                  Mar 12 '18 at 11:30





                  It's available form iOS 10, not iOS 11.

                  – matm
                  Mar 12 '18 at 11:30













                  @matm you are right. Edited the answer. Thanks.

                  – Bem
                  Mar 14 '18 at 8:30





                  @matm you are right. Edited the answer. Thanks.

                  – Bem
                  Mar 14 '18 at 8:30




                  3




                  3





                  not working for iOS 12... Any solutions?

                  – Gal Shahar
                  Sep 20 '18 at 10:33





                  not working for iOS 12... Any solutions?

                  – Gal Shahar
                  Sep 20 '18 at 10:33













                  @GalShahar I can't test it right now but here is my suggestion: iOS 12 introduces a new UITextContentType which is called newPassword (see: developer.apple.com/documentation/uikit/uitextcontenttype/…). Try setting the password text fields content type to this type. I guess iOS will not show the autofill accessory view then, because the user is forced to setup a new password and not use/access one that was setup before by using the autofill accessory view. Right now this is only theory. I'm not sure whether this will work, but let me know whether it does!

                  – Bem
                  Sep 21 '18 at 11:50





                  @GalShahar I can't test it right now but here is my suggestion: iOS 12 introduces a new UITextContentType which is called newPassword (see: developer.apple.com/documentation/uikit/uitextcontenttype/…). Try setting the password text fields content type to this type. I guess iOS will not show the autofill accessory view then, because the user is forced to setup a new password and not use/access one that was setup before by using the autofill accessory view. Right now this is only theory. I'm not sure whether this will work, but let me know whether it does!

                  – Bem
                  Sep 21 '18 at 11:50




                  1




                  1





                  This works great on iOS 12 for me

                  – Zach
                  Oct 22 '18 at 23:56





                  This works great on iOS 12 for me

                  – Zach
                  Oct 22 '18 at 23:56













                  8














                  The feature can be disabled by specifying a content type that is neither username nor password. For example, if the user should enter an email address, you could use



                  usernameTextField?.textContentType = .emailAddress





                  share|improve this answer


















                  • 1





                    Interestingly I have an email address field above a password field, and the email address field offers an auto-complete.

                    – Brad Root
                    Sep 7 '17 at 2:10











                  • @BradRoot change your password field textContentype too! if your email is already saved in keychain then it will show the info in quickbar, so better to user .nickname or try this code if #available(iOS 10.0, *) self.passwordTextField.textContentType = UITextContentType.init(rawValue: "") else // Fallback on earlier versions

                    – Sahil
                    Sep 28 '17 at 5:48
















                  8














                  The feature can be disabled by specifying a content type that is neither username nor password. For example, if the user should enter an email address, you could use



                  usernameTextField?.textContentType = .emailAddress





                  share|improve this answer


















                  • 1





                    Interestingly I have an email address field above a password field, and the email address field offers an auto-complete.

                    – Brad Root
                    Sep 7 '17 at 2:10











                  • @BradRoot change your password field textContentype too! if your email is already saved in keychain then it will show the info in quickbar, so better to user .nickname or try this code if #available(iOS 10.0, *) self.passwordTextField.textContentType = UITextContentType.init(rawValue: "") else // Fallback on earlier versions

                    – Sahil
                    Sep 28 '17 at 5:48














                  8












                  8








                  8







                  The feature can be disabled by specifying a content type that is neither username nor password. For example, if the user should enter an email address, you could use



                  usernameTextField?.textContentType = .emailAddress





                  share|improve this answer













                  The feature can be disabled by specifying a content type that is neither username nor password. For example, if the user should enter an email address, you could use



                  usernameTextField?.textContentType = .emailAddress






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 29 '17 at 16:42









                  gebirgsbärbelgebirgsbärbel

                  1,39211631




                  1,39211631







                  • 1





                    Interestingly I have an email address field above a password field, and the email address field offers an auto-complete.

                    – Brad Root
                    Sep 7 '17 at 2:10











                  • @BradRoot change your password field textContentype too! if your email is already saved in keychain then it will show the info in quickbar, so better to user .nickname or try this code if #available(iOS 10.0, *) self.passwordTextField.textContentType = UITextContentType.init(rawValue: "") else // Fallback on earlier versions

                    – Sahil
                    Sep 28 '17 at 5:48













                  • 1





                    Interestingly I have an email address field above a password field, and the email address field offers an auto-complete.

                    – Brad Root
                    Sep 7 '17 at 2:10











                  • @BradRoot change your password field textContentype too! if your email is already saved in keychain then it will show the info in quickbar, so better to user .nickname or try this code if #available(iOS 10.0, *) self.passwordTextField.textContentType = UITextContentType.init(rawValue: "") else // Fallback on earlier versions

                    – Sahil
                    Sep 28 '17 at 5:48








                  1




                  1





                  Interestingly I have an email address field above a password field, and the email address field offers an auto-complete.

                  – Brad Root
                  Sep 7 '17 at 2:10





                  Interestingly I have an email address field above a password field, and the email address field offers an auto-complete.

                  – Brad Root
                  Sep 7 '17 at 2:10













                  @BradRoot change your password field textContentype too! if your email is already saved in keychain then it will show the info in quickbar, so better to user .nickname or try this code if #available(iOS 10.0, *) self.passwordTextField.textContentType = UITextContentType.init(rawValue: "") else // Fallback on earlier versions

                  – Sahil
                  Sep 28 '17 at 5:48






                  @BradRoot change your password field textContentype too! if your email is already saved in keychain then it will show the info in quickbar, so better to user .nickname or try this code if #available(iOS 10.0, *) self.passwordTextField.textContentType = UITextContentType.init(rawValue: "") else // Fallback on earlier versions

                  – Sahil
                  Sep 28 '17 at 5:48












                  8














                  iOS 12 seems to recognise password textFields also by isSecureTextEntry property and not just by textContentType property, so making this accessory view disappear is not really possible unless you both set textContentType to nothing, and remove the secureEntry feature (and cause a security flaw in your app) which then prevents iOS 12 to recognise the textField as a password textField and show this annoying accessory view.



                  In my case the accessory caused a bug which made my app unresponsive when tapped (Which also got my app rejected in app review process). So I had to remove this feature. I didn't want to give on up this security feature so I had to solve things by my self.



                  The idea is to remove the secureEntry feature but add it by yourself manually. It did worked:



                  enter image description here




                  It can be done like that:



                  Swift 4 way:



                  First, as answered here, set textContentType to nothing:



                  if #available(iOS 10.0, *) 
                  passwordText.textContentType = UITextContentType("")
                  emailText.textContentType = UITextContentType("")



                  Than, declare a String variable which will later contain our textField real content:



                  var passwordValue = ""



                  Add a target to the passwordTextField, which will be called each time the textField content changes:



                  passwordText.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)


                  Now That's what will do the magic, declare the function that will handle the text replacements:



                  @objc func textFieldDidChange(_ textField: UITextField) 
                  if textField.text!.count > 1
                  // User did copy & paste
                  if passwordValue.count == 0 // Pasted into an empty textField
                  passwordValue = String(textField.text!)
                  else // Pasted to a non empty textField
                  passwordValue += textField.text!.substring(from: passwordValue.count)

                  else
                  // User did input by keypad
                  if textField.text!.count > passwordValue.count // Added chars
                  passwordValue += String(textField.text!.last!)
                  else if textField.text!.count < passwordValue.count // Removed chars
                  passwordValue = String(passwordValue.dropLast())


                  self.passwordText.text = String(repeating: "•", count: self.passwordText.text!.count)



                  Finally, Set textField's autocorrectionType to .no to remove predictive text:



                  passwordText.autocorrectionType = .no


                  That's it, use passwordValue to perform your login.



                  Hope it'll help someone.



                  UPDATE



                  It catches pasted values also, forgot to add it before.






                  share|improve this answer




















                  • 1





                    Super! Nice hack buddy! shame that iOS makes us hack rather than providing cleaner ways to do the most basic things. This should be the accepted answer.

                    – Josh
                    Sep 24 '18 at 12:50















                  8














                  iOS 12 seems to recognise password textFields also by isSecureTextEntry property and not just by textContentType property, so making this accessory view disappear is not really possible unless you both set textContentType to nothing, and remove the secureEntry feature (and cause a security flaw in your app) which then prevents iOS 12 to recognise the textField as a password textField and show this annoying accessory view.



                  In my case the accessory caused a bug which made my app unresponsive when tapped (Which also got my app rejected in app review process). So I had to remove this feature. I didn't want to give on up this security feature so I had to solve things by my self.



                  The idea is to remove the secureEntry feature but add it by yourself manually. It did worked:



                  enter image description here




                  It can be done like that:



                  Swift 4 way:



                  First, as answered here, set textContentType to nothing:



                  if #available(iOS 10.0, *) 
                  passwordText.textContentType = UITextContentType("")
                  emailText.textContentType = UITextContentType("")



                  Than, declare a String variable which will later contain our textField real content:



                  var passwordValue = ""



                  Add a target to the passwordTextField, which will be called each time the textField content changes:



                  passwordText.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)


                  Now That's what will do the magic, declare the function that will handle the text replacements:



                  @objc func textFieldDidChange(_ textField: UITextField) 
                  if textField.text!.count > 1
                  // User did copy & paste
                  if passwordValue.count == 0 // Pasted into an empty textField
                  passwordValue = String(textField.text!)
                  else // Pasted to a non empty textField
                  passwordValue += textField.text!.substring(from: passwordValue.count)

                  else
                  // User did input by keypad
                  if textField.text!.count > passwordValue.count // Added chars
                  passwordValue += String(textField.text!.last!)
                  else if textField.text!.count < passwordValue.count // Removed chars
                  passwordValue = String(passwordValue.dropLast())


                  self.passwordText.text = String(repeating: "•", count: self.passwordText.text!.count)



                  Finally, Set textField's autocorrectionType to .no to remove predictive text:



                  passwordText.autocorrectionType = .no


                  That's it, use passwordValue to perform your login.



                  Hope it'll help someone.



                  UPDATE



                  It catches pasted values also, forgot to add it before.






                  share|improve this answer




















                  • 1





                    Super! Nice hack buddy! shame that iOS makes us hack rather than providing cleaner ways to do the most basic things. This should be the accepted answer.

                    – Josh
                    Sep 24 '18 at 12:50













                  8












                  8








                  8







                  iOS 12 seems to recognise password textFields also by isSecureTextEntry property and not just by textContentType property, so making this accessory view disappear is not really possible unless you both set textContentType to nothing, and remove the secureEntry feature (and cause a security flaw in your app) which then prevents iOS 12 to recognise the textField as a password textField and show this annoying accessory view.



                  In my case the accessory caused a bug which made my app unresponsive when tapped (Which also got my app rejected in app review process). So I had to remove this feature. I didn't want to give on up this security feature so I had to solve things by my self.



                  The idea is to remove the secureEntry feature but add it by yourself manually. It did worked:



                  enter image description here




                  It can be done like that:



                  Swift 4 way:



                  First, as answered here, set textContentType to nothing:



                  if #available(iOS 10.0, *) 
                  passwordText.textContentType = UITextContentType("")
                  emailText.textContentType = UITextContentType("")



                  Than, declare a String variable which will later contain our textField real content:



                  var passwordValue = ""



                  Add a target to the passwordTextField, which will be called each time the textField content changes:



                  passwordText.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)


                  Now That's what will do the magic, declare the function that will handle the text replacements:



                  @objc func textFieldDidChange(_ textField: UITextField) 
                  if textField.text!.count > 1
                  // User did copy & paste
                  if passwordValue.count == 0 // Pasted into an empty textField
                  passwordValue = String(textField.text!)
                  else // Pasted to a non empty textField
                  passwordValue += textField.text!.substring(from: passwordValue.count)

                  else
                  // User did input by keypad
                  if textField.text!.count > passwordValue.count // Added chars
                  passwordValue += String(textField.text!.last!)
                  else if textField.text!.count < passwordValue.count // Removed chars
                  passwordValue = String(passwordValue.dropLast())


                  self.passwordText.text = String(repeating: "•", count: self.passwordText.text!.count)



                  Finally, Set textField's autocorrectionType to .no to remove predictive text:



                  passwordText.autocorrectionType = .no


                  That's it, use passwordValue to perform your login.



                  Hope it'll help someone.



                  UPDATE



                  It catches pasted values also, forgot to add it before.






                  share|improve this answer















                  iOS 12 seems to recognise password textFields also by isSecureTextEntry property and not just by textContentType property, so making this accessory view disappear is not really possible unless you both set textContentType to nothing, and remove the secureEntry feature (and cause a security flaw in your app) which then prevents iOS 12 to recognise the textField as a password textField and show this annoying accessory view.



                  In my case the accessory caused a bug which made my app unresponsive when tapped (Which also got my app rejected in app review process). So I had to remove this feature. I didn't want to give on up this security feature so I had to solve things by my self.



                  The idea is to remove the secureEntry feature but add it by yourself manually. It did worked:



                  enter image description here




                  It can be done like that:



                  Swift 4 way:



                  First, as answered here, set textContentType to nothing:



                  if #available(iOS 10.0, *) 
                  passwordText.textContentType = UITextContentType("")
                  emailText.textContentType = UITextContentType("")



                  Than, declare a String variable which will later contain our textField real content:



                  var passwordValue = ""



                  Add a target to the passwordTextField, which will be called each time the textField content changes:



                  passwordText.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)


                  Now That's what will do the magic, declare the function that will handle the text replacements:



                  @objc func textFieldDidChange(_ textField: UITextField) 
                  if textField.text!.count > 1
                  // User did copy & paste
                  if passwordValue.count == 0 // Pasted into an empty textField
                  passwordValue = String(textField.text!)
                  else // Pasted to a non empty textField
                  passwordValue += textField.text!.substring(from: passwordValue.count)

                  else
                  // User did input by keypad
                  if textField.text!.count > passwordValue.count // Added chars
                  passwordValue += String(textField.text!.last!)
                  else if textField.text!.count < passwordValue.count // Removed chars
                  passwordValue = String(passwordValue.dropLast())


                  self.passwordText.text = String(repeating: "•", count: self.passwordText.text!.count)



                  Finally, Set textField's autocorrectionType to .no to remove predictive text:



                  passwordText.autocorrectionType = .no


                  That's it, use passwordValue to perform your login.



                  Hope it'll help someone.



                  UPDATE



                  It catches pasted values also, forgot to add it before.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 28 '18 at 17:24

























                  answered Sep 20 '18 at 14:04









                  Gal ShaharGal Shahar

                  296312




                  296312







                  • 1





                    Super! Nice hack buddy! shame that iOS makes us hack rather than providing cleaner ways to do the most basic things. This should be the accepted answer.

                    – Josh
                    Sep 24 '18 at 12:50












                  • 1





                    Super! Nice hack buddy! shame that iOS makes us hack rather than providing cleaner ways to do the most basic things. This should be the accepted answer.

                    – Josh
                    Sep 24 '18 at 12:50







                  1




                  1





                  Super! Nice hack buddy! shame that iOS makes us hack rather than providing cleaner ways to do the most basic things. This should be the accepted answer.

                  – Josh
                  Sep 24 '18 at 12:50





                  Super! Nice hack buddy! shame that iOS makes us hack rather than providing cleaner ways to do the most basic things. This should be the accepted answer.

                  – Josh
                  Sep 24 '18 at 12:50











                  7














                  You can add extension for UITextContentType like this



                  extension UITextContentType 
                  public static let unspecified = UITextContentType("unspecified")



                  after that, you can use it



                  if #available(iOS 10.0, *) 
                  passwordField.textContentType = .unspecified






                  share|improve this answer



























                    7














                    You can add extension for UITextContentType like this



                    extension UITextContentType 
                    public static let unspecified = UITextContentType("unspecified")



                    after that, you can use it



                    if #available(iOS 10.0, *) 
                    passwordField.textContentType = .unspecified






                    share|improve this answer

























                      7












                      7








                      7







                      You can add extension for UITextContentType like this



                      extension UITextContentType 
                      public static let unspecified = UITextContentType("unspecified")



                      after that, you can use it



                      if #available(iOS 10.0, *) 
                      passwordField.textContentType = .unspecified






                      share|improve this answer













                      You can add extension for UITextContentType like this



                      extension UITextContentType 
                      public static let unspecified = UITextContentType("unspecified")



                      after that, you can use it



                      if #available(iOS 10.0, *) 
                      passwordField.textContentType = .unspecified







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 14 '17 at 2:33









                      Mikhail ZinovMikhail Zinov

                      12618




                      12618





















                          6














                          A very simple approach in ios11 worked for me. Suppose your iboutlets are usernametextfield and passwordtextfield. In viewDidLoad() function of your viewcontroller that holds the both outlest use the following code



                          usernametextfield.textContentType = UITextContentType("")
                          passwordtextfield.textContentType = UITextContentType("")


                          After this you wont see autofill accessory option when you tap on your textfields.






                          share|improve this answer



























                            6














                            A very simple approach in ios11 worked for me. Suppose your iboutlets are usernametextfield and passwordtextfield. In viewDidLoad() function of your viewcontroller that holds the both outlest use the following code



                            usernametextfield.textContentType = UITextContentType("")
                            passwordtextfield.textContentType = UITextContentType("")


                            After this you wont see autofill accessory option when you tap on your textfields.






                            share|improve this answer

























                              6












                              6








                              6







                              A very simple approach in ios11 worked for me. Suppose your iboutlets are usernametextfield and passwordtextfield. In viewDidLoad() function of your viewcontroller that holds the both outlest use the following code



                              usernametextfield.textContentType = UITextContentType("")
                              passwordtextfield.textContentType = UITextContentType("")


                              After this you wont see autofill accessory option when you tap on your textfields.






                              share|improve this answer













                              A very simple approach in ios11 worked for me. Suppose your iboutlets are usernametextfield and passwordtextfield. In viewDidLoad() function of your viewcontroller that holds the both outlest use the following code



                              usernametextfield.textContentType = UITextContentType("")
                              passwordtextfield.textContentType = UITextContentType("")


                              After this you wont see autofill accessory option when you tap on your textfields.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Oct 3 '17 at 5:42









                              AmmadAmmad

                              24147




                              24147





















                                  5














                                  Objective-C



                                  if (@available(iOS 10, *))
                                  self.tfEmail.textContentType = @"";
                                  self.tfPassword.textContentType = @"";



                                  This worked for me.






                                  share|improve this answer



























                                    5














                                    Objective-C



                                    if (@available(iOS 10, *))
                                    self.tfEmail.textContentType = @"";
                                    self.tfPassword.textContentType = @"";



                                    This worked for me.






                                    share|improve this answer

























                                      5












                                      5








                                      5







                                      Objective-C



                                      if (@available(iOS 10, *))
                                      self.tfEmail.textContentType = @"";
                                      self.tfPassword.textContentType = @"";



                                      This worked for me.






                                      share|improve this answer













                                      Objective-C



                                      if (@available(iOS 10, *))
                                      self.tfEmail.textContentType = @"";
                                      self.tfPassword.textContentType = @"";



                                      This worked for me.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Feb 28 '18 at 18:52









                                      Matheus DomingosMatheus Domingos

                                      48157




                                      48157





















                                          3














                                          Autofill is by default enabled for users. iOS saves all passwords in the keychain and make them available in keyboard in your apps. UITextView and UITextField automatically considered for AutoFill password. you can disable by specifying a content type that is neither username nor password but if the content type info already stored in keychain it will show in the quick bar. so better to assign empty UITextContentType type and it will not show quickbar.



                                          Example:



                                           if #available(iOS 10.0, *) 
                                          self.textField.textContentType = UITextContentType("")
                                          else
                                          // Fallback on earlier versions






                                          share|improve this answer





























                                            3














                                            Autofill is by default enabled for users. iOS saves all passwords in the keychain and make them available in keyboard in your apps. UITextView and UITextField automatically considered for AutoFill password. you can disable by specifying a content type that is neither username nor password but if the content type info already stored in keychain it will show in the quick bar. so better to assign empty UITextContentType type and it will not show quickbar.



                                            Example:



                                             if #available(iOS 10.0, *) 
                                            self.textField.textContentType = UITextContentType("")
                                            else
                                            // Fallback on earlier versions






                                            share|improve this answer



























                                              3












                                              3








                                              3







                                              Autofill is by default enabled for users. iOS saves all passwords in the keychain and make them available in keyboard in your apps. UITextView and UITextField automatically considered for AutoFill password. you can disable by specifying a content type that is neither username nor password but if the content type info already stored in keychain it will show in the quick bar. so better to assign empty UITextContentType type and it will not show quickbar.



                                              Example:



                                               if #available(iOS 10.0, *) 
                                              self.textField.textContentType = UITextContentType("")
                                              else
                                              // Fallback on earlier versions






                                              share|improve this answer















                                              Autofill is by default enabled for users. iOS saves all passwords in the keychain and make them available in keyboard in your apps. UITextView and UITextField automatically considered for AutoFill password. you can disable by specifying a content type that is neither username nor password but if the content type info already stored in keychain it will show in the quick bar. so better to assign empty UITextContentType type and it will not show quickbar.



                                              Example:



                                               if #available(iOS 10.0, *) 
                                              self.textField.textContentType = UITextContentType("")
                                              else
                                              // Fallback on earlier versions







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Sep 28 '17 at 6:43

























                                              answered Sep 28 '17 at 6:29









                                              SahilSahil

                                              6,56431625




                                              6,56431625





















                                                  2














                                                  Objective C version:



                                                  if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) 
                                                  self.passwordTextField.textContentType = @"";
                                                  self.confirmPasswordTextField.textContentType = @"";



                                                  where



                                                  #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
                                                  #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
                                                  #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
                                                  #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
                                                  #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)





                                                  share|improve this answer



























                                                    2














                                                    Objective C version:



                                                    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) 
                                                    self.passwordTextField.textContentType = @"";
                                                    self.confirmPasswordTextField.textContentType = @"";



                                                    where



                                                    #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
                                                    #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
                                                    #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
                                                    #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
                                                    #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)





                                                    share|improve this answer

























                                                      2












                                                      2








                                                      2







                                                      Objective C version:



                                                      if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) 
                                                      self.passwordTextField.textContentType = @"";
                                                      self.confirmPasswordTextField.textContentType = @"";



                                                      where



                                                      #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
                                                      #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
                                                      #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
                                                      #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
                                                      #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)





                                                      share|improve this answer













                                                      Objective C version:



                                                      if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) 
                                                      self.passwordTextField.textContentType = @"";
                                                      self.confirmPasswordTextField.textContentType = @"";



                                                      where



                                                      #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
                                                      #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
                                                      #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
                                                      #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
                                                      #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)






                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered Jan 9 '18 at 11:23









                                                      wzbozonwzbozon

                                                      8,93655960




                                                      8,93655960





















                                                          1














                                                          You could try different answers here that conclude its likely possible to remove accessoryview. But this leaves some bugs.



                                                          How to hide inputAccessoryView without dismissing keyboard



                                                          You could try to implement a custom keyboard perhaps, only for password fields. Also try to disable suggestions for your textfield, i think that also hides the accessoryView.



                                                          EDIT:
                                                          No answer on apple forums on same question as of yet. Also i couldnt find anything regarding this in official uitextfield documentation.



                                                          https://forums.developer.apple.com/thread/82442






                                                          share|improve this answer





























                                                            1














                                                            You could try different answers here that conclude its likely possible to remove accessoryview. But this leaves some bugs.



                                                            How to hide inputAccessoryView without dismissing keyboard



                                                            You could try to implement a custom keyboard perhaps, only for password fields. Also try to disable suggestions for your textfield, i think that also hides the accessoryView.



                                                            EDIT:
                                                            No answer on apple forums on same question as of yet. Also i couldnt find anything regarding this in official uitextfield documentation.



                                                            https://forums.developer.apple.com/thread/82442






                                                            share|improve this answer



























                                                              1












                                                              1








                                                              1







                                                              You could try different answers here that conclude its likely possible to remove accessoryview. But this leaves some bugs.



                                                              How to hide inputAccessoryView without dismissing keyboard



                                                              You could try to implement a custom keyboard perhaps, only for password fields. Also try to disable suggestions for your textfield, i think that also hides the accessoryView.



                                                              EDIT:
                                                              No answer on apple forums on same question as of yet. Also i couldnt find anything regarding this in official uitextfield documentation.



                                                              https://forums.developer.apple.com/thread/82442






                                                              share|improve this answer















                                                              You could try different answers here that conclude its likely possible to remove accessoryview. But this leaves some bugs.



                                                              How to hide inputAccessoryView without dismissing keyboard



                                                              You could try to implement a custom keyboard perhaps, only for password fields. Also try to disable suggestions for your textfield, i think that also hides the accessoryView.



                                                              EDIT:
                                                              No answer on apple forums on same question as of yet. Also i couldnt find anything regarding this in official uitextfield documentation.



                                                              https://forums.developer.apple.com/thread/82442







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Aug 2 '17 at 8:35









                                                              Nazmul Hasan

                                                              5,44443452




                                                              5,44443452










                                                              answered Aug 2 '17 at 5:33









                                                              RishabhRishabh

                                                              321212




                                                              321212





















                                                                  1














                                                                  You can "turn off" the username/password combo detection by assigning a dummy textContentType to the password text field.



                                                                  passwordFormField.textContentType = UITextContentType("dummy")


                                                                  This turned off the key symbol for both the password field and the email field that preceded it, and in this way you don't use one of the predefined values and you avoid showing unrelated suggestions in the keyboard accessory view.






                                                                  share|improve this answer























                                                                  • Does this still work on the latest iOS 12 beta for you?

                                                                    – pfandrade
                                                                    Aug 9 '18 at 11:22











                                                                  • No it does not. On iOS 12 it detects this field as a new password field and suggests a new strong password (new iOS 12 feature). I actually want this behavior in my case, so I'm tagging this password field with the new iOS 12 newPassword UITextContentType . I don't know how to avoid this new behavior though.

                                                                    – Miguel Cabeça
                                                                    Aug 20 '18 at 7:28











                                                                  • For iOS 12 beta, if use: textContentType = UITextContentType.oneTimeCode. Then, it doesn't have the keychain on the keyboard. It seems to work fine for me without any side effects. If you use .newPassword, that also works, but then it asks you to save the password once you finish with the password.

                                                                    – Daniel Jones
                                                                    Sep 5 '18 at 21:22















                                                                  1














                                                                  You can "turn off" the username/password combo detection by assigning a dummy textContentType to the password text field.



                                                                  passwordFormField.textContentType = UITextContentType("dummy")


                                                                  This turned off the key symbol for both the password field and the email field that preceded it, and in this way you don't use one of the predefined values and you avoid showing unrelated suggestions in the keyboard accessory view.






                                                                  share|improve this answer























                                                                  • Does this still work on the latest iOS 12 beta for you?

                                                                    – pfandrade
                                                                    Aug 9 '18 at 11:22











                                                                  • No it does not. On iOS 12 it detects this field as a new password field and suggests a new strong password (new iOS 12 feature). I actually want this behavior in my case, so I'm tagging this password field with the new iOS 12 newPassword UITextContentType . I don't know how to avoid this new behavior though.

                                                                    – Miguel Cabeça
                                                                    Aug 20 '18 at 7:28











                                                                  • For iOS 12 beta, if use: textContentType = UITextContentType.oneTimeCode. Then, it doesn't have the keychain on the keyboard. It seems to work fine for me without any side effects. If you use .newPassword, that also works, but then it asks you to save the password once you finish with the password.

                                                                    – Daniel Jones
                                                                    Sep 5 '18 at 21:22













                                                                  1












                                                                  1








                                                                  1







                                                                  You can "turn off" the username/password combo detection by assigning a dummy textContentType to the password text field.



                                                                  passwordFormField.textContentType = UITextContentType("dummy")


                                                                  This turned off the key symbol for both the password field and the email field that preceded it, and in this way you don't use one of the predefined values and you avoid showing unrelated suggestions in the keyboard accessory view.






                                                                  share|improve this answer













                                                                  You can "turn off" the username/password combo detection by assigning a dummy textContentType to the password text field.



                                                                  passwordFormField.textContentType = UITextContentType("dummy")


                                                                  This turned off the key symbol for both the password field and the email field that preceded it, and in this way you don't use one of the predefined values and you avoid showing unrelated suggestions in the keyboard accessory view.







                                                                  share|improve this answer












                                                                  share|improve this answer



                                                                  share|improve this answer










                                                                  answered Sep 27 '17 at 13:19









                                                                  Miguel CabeçaMiguel Cabeça

                                                                  411




                                                                  411












                                                                  • Does this still work on the latest iOS 12 beta for you?

                                                                    – pfandrade
                                                                    Aug 9 '18 at 11:22











                                                                  • No it does not. On iOS 12 it detects this field as a new password field and suggests a new strong password (new iOS 12 feature). I actually want this behavior in my case, so I'm tagging this password field with the new iOS 12 newPassword UITextContentType . I don't know how to avoid this new behavior though.

                                                                    – Miguel Cabeça
                                                                    Aug 20 '18 at 7:28











                                                                  • For iOS 12 beta, if use: textContentType = UITextContentType.oneTimeCode. Then, it doesn't have the keychain on the keyboard. It seems to work fine for me without any side effects. If you use .newPassword, that also works, but then it asks you to save the password once you finish with the password.

                                                                    – Daniel Jones
                                                                    Sep 5 '18 at 21:22

















                                                                  • Does this still work on the latest iOS 12 beta for you?

                                                                    – pfandrade
                                                                    Aug 9 '18 at 11:22











                                                                  • No it does not. On iOS 12 it detects this field as a new password field and suggests a new strong password (new iOS 12 feature). I actually want this behavior in my case, so I'm tagging this password field with the new iOS 12 newPassword UITextContentType . I don't know how to avoid this new behavior though.

                                                                    – Miguel Cabeça
                                                                    Aug 20 '18 at 7:28











                                                                  • For iOS 12 beta, if use: textContentType = UITextContentType.oneTimeCode. Then, it doesn't have the keychain on the keyboard. It seems to work fine for me without any side effects. If you use .newPassword, that also works, but then it asks you to save the password once you finish with the password.

                                                                    – Daniel Jones
                                                                    Sep 5 '18 at 21:22
















                                                                  Does this still work on the latest iOS 12 beta for you?

                                                                  – pfandrade
                                                                  Aug 9 '18 at 11:22





                                                                  Does this still work on the latest iOS 12 beta for you?

                                                                  – pfandrade
                                                                  Aug 9 '18 at 11:22













                                                                  No it does not. On iOS 12 it detects this field as a new password field and suggests a new strong password (new iOS 12 feature). I actually want this behavior in my case, so I'm tagging this password field with the new iOS 12 newPassword UITextContentType . I don't know how to avoid this new behavior though.

                                                                  – Miguel Cabeça
                                                                  Aug 20 '18 at 7:28





                                                                  No it does not. On iOS 12 it detects this field as a new password field and suggests a new strong password (new iOS 12 feature). I actually want this behavior in my case, so I'm tagging this password field with the new iOS 12 newPassword UITextContentType . I don't know how to avoid this new behavior though.

                                                                  – Miguel Cabeça
                                                                  Aug 20 '18 at 7:28













                                                                  For iOS 12 beta, if use: textContentType = UITextContentType.oneTimeCode. Then, it doesn't have the keychain on the keyboard. It seems to work fine for me without any side effects. If you use .newPassword, that also works, but then it asks you to save the password once you finish with the password.

                                                                  – Daniel Jones
                                                                  Sep 5 '18 at 21:22





                                                                  For iOS 12 beta, if use: textContentType = UITextContentType.oneTimeCode. Then, it doesn't have the keychain on the keyboard. It seems to work fine for me without any side effects. If you use .newPassword, that also works, but then it asks you to save the password once you finish with the password.

                                                                  – Daniel Jones
                                                                  Sep 5 '18 at 21:22











                                                                  1














                                                                  self.passwordTextField.autocorrectionType = NO;


                                                                  It does not seem to work, the keychain sign still there,



                                                                  self.passwordTextField.textContentType = UITextContentTypeName;


                                                                  The code above does work, but if the users set up their Apple ID account, Then, the name of the apple id will be display on the keyboard you cannot disable it by set autocorrectionType to No, not sure if Apple still refines this autofill feature, it's quite buggy right now.






                                                                  share|improve this answer

























                                                                  • This type of 'answer' should be reserved for the comments section, as it doesn't give an actual answer or link to any reference documentation from apple etc. Welcome to SO though!

                                                                    – stktrc
                                                                    Aug 4 '17 at 4:00











                                                                  • no solution yet. Nothing listed here worked well for me.

                                                                    – zumzum
                                                                    Aug 15 '17 at 16:46















                                                                  1














                                                                  self.passwordTextField.autocorrectionType = NO;


                                                                  It does not seem to work, the keychain sign still there,



                                                                  self.passwordTextField.textContentType = UITextContentTypeName;


                                                                  The code above does work, but if the users set up their Apple ID account, Then, the name of the apple id will be display on the keyboard you cannot disable it by set autocorrectionType to No, not sure if Apple still refines this autofill feature, it's quite buggy right now.






                                                                  share|improve this answer

























                                                                  • This type of 'answer' should be reserved for the comments section, as it doesn't give an actual answer or link to any reference documentation from apple etc. Welcome to SO though!

                                                                    – stktrc
                                                                    Aug 4 '17 at 4:00











                                                                  • no solution yet. Nothing listed here worked well for me.

                                                                    – zumzum
                                                                    Aug 15 '17 at 16:46













                                                                  1












                                                                  1








                                                                  1







                                                                  self.passwordTextField.autocorrectionType = NO;


                                                                  It does not seem to work, the keychain sign still there,



                                                                  self.passwordTextField.textContentType = UITextContentTypeName;


                                                                  The code above does work, but if the users set up their Apple ID account, Then, the name of the apple id will be display on the keyboard you cannot disable it by set autocorrectionType to No, not sure if Apple still refines this autofill feature, it's quite buggy right now.






                                                                  share|improve this answer















                                                                  self.passwordTextField.autocorrectionType = NO;


                                                                  It does not seem to work, the keychain sign still there,



                                                                  self.passwordTextField.textContentType = UITextContentTypeName;


                                                                  The code above does work, but if the users set up their Apple ID account, Then, the name of the apple id will be display on the keyboard you cannot disable it by set autocorrectionType to No, not sure if Apple still refines this autofill feature, it's quite buggy right now.







                                                                  share|improve this answer














                                                                  share|improve this answer



                                                                  share|improve this answer








                                                                  edited Dec 13 '18 at 7:28









                                                                  Ankit Jayaswal

                                                                  3,2312529




                                                                  3,2312529










                                                                  answered Aug 4 '17 at 3:38









                                                                  Roger HanRoger Han

                                                                  112




                                                                  112












                                                                  • This type of 'answer' should be reserved for the comments section, as it doesn't give an actual answer or link to any reference documentation from apple etc. Welcome to SO though!

                                                                    – stktrc
                                                                    Aug 4 '17 at 4:00











                                                                  • no solution yet. Nothing listed here worked well for me.

                                                                    – zumzum
                                                                    Aug 15 '17 at 16:46

















                                                                  • This type of 'answer' should be reserved for the comments section, as it doesn't give an actual answer or link to any reference documentation from apple etc. Welcome to SO though!

                                                                    – stktrc
                                                                    Aug 4 '17 at 4:00











                                                                  • no solution yet. Nothing listed here worked well for me.

                                                                    – zumzum
                                                                    Aug 15 '17 at 16:46
















                                                                  This type of 'answer' should be reserved for the comments section, as it doesn't give an actual answer or link to any reference documentation from apple etc. Welcome to SO though!

                                                                  – stktrc
                                                                  Aug 4 '17 at 4:00





                                                                  This type of 'answer' should be reserved for the comments section, as it doesn't give an actual answer or link to any reference documentation from apple etc. Welcome to SO though!

                                                                  – stktrc
                                                                  Aug 4 '17 at 4:00













                                                                  no solution yet. Nothing listed here worked well for me.

                                                                  – zumzum
                                                                  Aug 15 '17 at 16:46





                                                                  no solution yet. Nothing listed here worked well for me.

                                                                  – zumzum
                                                                  Aug 15 '17 at 16:46











                                                                  1














                                                                  This worked for ios 12 and 10:



                                                                  if (@available(iOS 10, *)) 
                                                                  passwordTextField.textContentType = UITextContentTypeStreetAddressLine2;


                                                                  if (@available(iOS 12, *))
                                                                  passwordTextField.textContentType = UITextContentTypeOneTimeCode;






                                                                  share|improve this answer





























                                                                    1














                                                                    This worked for ios 12 and 10:



                                                                    if (@available(iOS 10, *)) 
                                                                    passwordTextField.textContentType = UITextContentTypeStreetAddressLine2;


                                                                    if (@available(iOS 12, *))
                                                                    passwordTextField.textContentType = UITextContentTypeOneTimeCode;






                                                                    share|improve this answer



























                                                                      1












                                                                      1








                                                                      1







                                                                      This worked for ios 12 and 10:



                                                                      if (@available(iOS 10, *)) 
                                                                      passwordTextField.textContentType = UITextContentTypeStreetAddressLine2;


                                                                      if (@available(iOS 12, *))
                                                                      passwordTextField.textContentType = UITextContentTypeOneTimeCode;






                                                                      share|improve this answer















                                                                      This worked for ios 12 and 10:



                                                                      if (@available(iOS 10, *)) 
                                                                      passwordTextField.textContentType = UITextContentTypeStreetAddressLine2;


                                                                      if (@available(iOS 12, *))
                                                                      passwordTextField.textContentType = UITextContentTypeOneTimeCode;







                                                                      share|improve this answer














                                                                      share|improve this answer



                                                                      share|improve this answer








                                                                      edited Feb 4 at 12:59

























                                                                      answered Dec 26 '18 at 13:29









                                                                      no_fateno_fate

                                                                      365212




                                                                      365212





















                                                                          0














                                                                          in response to @Gal Shahar Answer.



                                                                          iOS 12 recognise password textFields by isSecureTextEntry property and not just by textContentType property.



                                                                          Way Around to bypass Auto-fill Suggestion.



                                                                          1. set isSecureTextEntry property to false.

                                                                          self.passwordTextField.secureTextEntry = NO;



                                                                          1. Add a UITextField Delegate Method and enable the isSecureTextEntry property.

                                                                          - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
                                                                          if (textField == self.passwordTextField && !self.passwordTextField.secureTextEntry)
                                                                          self.passwordTextField.secureTextEntry = YES;


                                                                          return YES;



                                                                          NOTE: -
                                                                          Do NOT Use shouldBeginEditing UITextField delegate method it Will Still show Auto-filling Suggestion.
                                                                          Do NOT Use textFieldDidChange UITextField delegate method it Will Auto-delete the first charachter as the it Will happen after the first charachter is displayed. And 'secureTextEntry' will empty the field.






                                                                          share|improve this answer



























                                                                            0














                                                                            in response to @Gal Shahar Answer.



                                                                            iOS 12 recognise password textFields by isSecureTextEntry property and not just by textContentType property.



                                                                            Way Around to bypass Auto-fill Suggestion.



                                                                            1. set isSecureTextEntry property to false.

                                                                            self.passwordTextField.secureTextEntry = NO;



                                                                            1. Add a UITextField Delegate Method and enable the isSecureTextEntry property.

                                                                            - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
                                                                            if (textField == self.passwordTextField && !self.passwordTextField.secureTextEntry)
                                                                            self.passwordTextField.secureTextEntry = YES;


                                                                            return YES;



                                                                            NOTE: -
                                                                            Do NOT Use shouldBeginEditing UITextField delegate method it Will Still show Auto-filling Suggestion.
                                                                            Do NOT Use textFieldDidChange UITextField delegate method it Will Auto-delete the first charachter as the it Will happen after the first charachter is displayed. And 'secureTextEntry' will empty the field.






                                                                            share|improve this answer

























                                                                              0












                                                                              0








                                                                              0







                                                                              in response to @Gal Shahar Answer.



                                                                              iOS 12 recognise password textFields by isSecureTextEntry property and not just by textContentType property.



                                                                              Way Around to bypass Auto-fill Suggestion.



                                                                              1. set isSecureTextEntry property to false.

                                                                              self.passwordTextField.secureTextEntry = NO;



                                                                              1. Add a UITextField Delegate Method and enable the isSecureTextEntry property.

                                                                              - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
                                                                              if (textField == self.passwordTextField && !self.passwordTextField.secureTextEntry)
                                                                              self.passwordTextField.secureTextEntry = YES;


                                                                              return YES;



                                                                              NOTE: -
                                                                              Do NOT Use shouldBeginEditing UITextField delegate method it Will Still show Auto-filling Suggestion.
                                                                              Do NOT Use textFieldDidChange UITextField delegate method it Will Auto-delete the first charachter as the it Will happen after the first charachter is displayed. And 'secureTextEntry' will empty the field.






                                                                              share|improve this answer













                                                                              in response to @Gal Shahar Answer.



                                                                              iOS 12 recognise password textFields by isSecureTextEntry property and not just by textContentType property.



                                                                              Way Around to bypass Auto-fill Suggestion.



                                                                              1. set isSecureTextEntry property to false.

                                                                              self.passwordTextField.secureTextEntry = NO;



                                                                              1. Add a UITextField Delegate Method and enable the isSecureTextEntry property.

                                                                              - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
                                                                              if (textField == self.passwordTextField && !self.passwordTextField.secureTextEntry)
                                                                              self.passwordTextField.secureTextEntry = YES;


                                                                              return YES;



                                                                              NOTE: -
                                                                              Do NOT Use shouldBeginEditing UITextField delegate method it Will Still show Auto-filling Suggestion.
                                                                              Do NOT Use textFieldDidChange UITextField delegate method it Will Auto-delete the first charachter as the it Will happen after the first charachter is displayed. And 'secureTextEntry' will empty the field.







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered yesterday









                                                                              ashishashish

                                                                              10615




                                                                              10615





















                                                                                  -1














                                                                                  This worked for me:



                                                                                  NOTE: try putting this code on the password, password confirm (if applicable), AND email textfields. I was not putting it on the email textfield and it was still popping up for the two password fields.



                                                                                  if #available(iOS 12, *) 
                                                                                  // iOS 12: Not the best solution, but it works.
                                                                                  cell.textField.textContentType = .oneTimeCode
                                                                                  else
                                                                                  // iOS 11: Disables the autofill accessory view.
                                                                                  cell.textField.textContentType = .init(rawValue: "")






                                                                                  share|improve this answer























                                                                                  • This is the same as Bem’s answer.

                                                                                    – ayaio
                                                                                    Feb 1 at 19:03















                                                                                  -1














                                                                                  This worked for me:



                                                                                  NOTE: try putting this code on the password, password confirm (if applicable), AND email textfields. I was not putting it on the email textfield and it was still popping up for the two password fields.



                                                                                  if #available(iOS 12, *) 
                                                                                  // iOS 12: Not the best solution, but it works.
                                                                                  cell.textField.textContentType = .oneTimeCode
                                                                                  else
                                                                                  // iOS 11: Disables the autofill accessory view.
                                                                                  cell.textField.textContentType = .init(rawValue: "")






                                                                                  share|improve this answer























                                                                                  • This is the same as Bem’s answer.

                                                                                    – ayaio
                                                                                    Feb 1 at 19:03













                                                                                  -1












                                                                                  -1








                                                                                  -1







                                                                                  This worked for me:



                                                                                  NOTE: try putting this code on the password, password confirm (if applicable), AND email textfields. I was not putting it on the email textfield and it was still popping up for the two password fields.



                                                                                  if #available(iOS 12, *) 
                                                                                  // iOS 12: Not the best solution, but it works.
                                                                                  cell.textField.textContentType = .oneTimeCode
                                                                                  else
                                                                                  // iOS 11: Disables the autofill accessory view.
                                                                                  cell.textField.textContentType = .init(rawValue: "")






                                                                                  share|improve this answer













                                                                                  This worked for me:



                                                                                  NOTE: try putting this code on the password, password confirm (if applicable), AND email textfields. I was not putting it on the email textfield and it was still popping up for the two password fields.



                                                                                  if #available(iOS 12, *) 
                                                                                  // iOS 12: Not the best solution, but it works.
                                                                                  cell.textField.textContentType = .oneTimeCode
                                                                                  else
                                                                                  // iOS 11: Disables the autofill accessory view.
                                                                                  cell.textField.textContentType = .init(rawValue: "")







                                                                                  share|improve this answer












                                                                                  share|improve this answer



                                                                                  share|improve this answer










                                                                                  answered Feb 1 at 17:47









                                                                                  Paul LehnPaul Lehn

                                                                                  1,7031422




                                                                                  1,7031422












                                                                                  • This is the same as Bem’s answer.

                                                                                    – ayaio
                                                                                    Feb 1 at 19:03

















                                                                                  • This is the same as Bem’s answer.

                                                                                    – ayaio
                                                                                    Feb 1 at 19:03
















                                                                                  This is the same as Bem’s answer.

                                                                                  – ayaio
                                                                                  Feb 1 at 19:03





                                                                                  This is the same as Bem’s answer.

                                                                                  – ayaio
                                                                                  Feb 1 at 19:03

















                                                                                  draft saved

                                                                                  draft discarded
















































                                                                                  Thanks for contributing an answer to Stack Overflow!


                                                                                  • Please be sure to answer the question. Provide details and share your research!

                                                                                  But avoid


                                                                                  • Asking for help, clarification, or responding to other answers.

                                                                                  • Making statements based on opinion; back them up with references or personal experience.

                                                                                  To learn more, see our tips on writing great answers.




                                                                                  draft saved


                                                                                  draft discarded














                                                                                  StackExchange.ready(
                                                                                  function ()
                                                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45452170%2fios-11-disable-password-autofill-accessory-view-option%23new-answer', 'question_page');

                                                                                  );

                                                                                  Post as a guest















                                                                                  Required, but never shown





















































                                                                                  Required, but never shown














                                                                                  Required, but never shown












                                                                                  Required, but never shown







                                                                                  Required, but never shown

































                                                                                  Required, but never shown














                                                                                  Required, but never shown












                                                                                  Required, but never shown







                                                                                  Required, but never shown







                                                                                  Popular posts from this blog

                                                                                  Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                                                                                  2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

                                                                                  Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme