iOS 11 disable password autofill accessory view option?

后端 未结 20 2321
孤独总比滥情好
孤独总比滥情好 2020-11-28 04:20

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 t

相关标签:
20条回答
  • 2020-11-28 04:55

    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.

    0 讨论(0)
  • 2020-11-28 04:56

    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
     }
    
    0 讨论(0)
提交回复
热议问题