I am encountering a difficulty with the autofill conduct in one among my iOS functions. On an motion affirmation display, customers can enter a purpose within the first textual content area and their account password within the second textual content area for validation objective. Nonetheless, when customers use biometric authentication (Contact ID/Face ID) to autofill the password, the username from the keychain is mistakenly being entered into the rationale textual content area (over-rides the already stuffed purpose).
Right here’s the setup:
- The primary textual content area (
reasonTextField
) is for customers to enter the rationale. - The second textual content area (
passwordTextField
) is for the account password.
I’ve tried the next options with out success:
- Setting
textContentType
to.none
for thereasonTextField
. - Making certain
passwordTextField
hastextContentType
set to.password
. - Utilizing distinct accessibility identifiers for each textual content fields.
Here is a simplified model of my code:
import UIKit
class ActionConfirmationViewController: UIViewController {
@IBOutlet weak var reasonTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
override func viewDidLoad() {
tremendous.viewDidLoad()
configureTextFields()
}
func configureTextFields() {
reasonTextField.textContentType = .none
reasonTextField.accessibilityIdentifier = "reasonTextField"
passwordTextField.textContentType = .password
passwordTextField.accessibilityIdentifier = "passwordTextField"
passwordTextField.isSecureTextEntry = true
}
}
Regardless of these measures, the problem persists. Has anybody skilled an identical drawback or have any solutions on the right way to forestall the username from being autofilled into the rationale textual content area? Any assist can be drastically appreciated!