OTP AutoFill Fails to Distribute Code Across Multiple UITextFields on iOS 26.x

Issue Summary: On iOS 26.0.1 to 26.3, apps using multiple UITextFields for OTP input face a critical issue where the system autofill pastes the entire OTP string into a single text field, usually the focused one, rather than splitting digits across fields. Delegate events like textDidChange: do not trigger consistently on autofill, breaking existing input handling logic.

Expected Behavior: OTP autofill should distribute each digit correctly across all OTP UITextFields.

Delegate or control events should fire on autofill to enable manual handling.

  • (BOOL)textField:(UITextField *)textField

shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {

if (string.length > 1) {
    // Autofill detected - distribute OTP manually
    for (int i = 0; i < string.length && i < self.arrayOTPText.count; i++) {
        UITextField *field = self.arrayOTPText[i];
        field.text = [NSString stringWithFormat:@"%c", [string characterAtIndex:i]];
    }
    UITextField *lastField = self.arrayOTPText[string.length - 1];
    [lastField becomeFirstResponder];
    return NO;
}

// Handle normal single character or deletion input here
return YES;

}

//

// Setup UITextFields - set .oneTimeCode on first field only for (int i = 0; i < self.arrayOTPText.count; i++) { UITextField *field = self.arrayOTPText[i]; field.delegate = self; if (@available(iOS 12.0, *)) { field.textContentType = (i == 0) ? UITextContentTypeOneTimeCode : UITextContentTypeNone; } }

What We’ve Tried:

Setting textContentType properly.

Handling OTP distribution in delegate method.

Verifying settings and keyboard use.

Testing on multiple iOS 26.x versions.

Impact:

Major usability degradation during OTP entry.

Forces fragile workarounds.

Inconsistent autofill reduces user confidence.

Request:

Request Apple fix OTP autofill to natively support multi-field UITextField OTP input or provide enhanced delegate callbacks for consistent behavior.

Did any one face this issue in recent time with iOS 26.0.1 to 26.3 beta version

I also ran into a similar issue. We found that the text field was losing the isFocused state. Redrawing the view caused this to be false.

Despite attempts to ensure that it was set to true. shouldChangeCharactersInRange does get called on autofill, but with an empty string not the OTP.

The yucky solution was to put a small delay before setting the focus state to true. This seemed to work around the bug.

No issues at all on iOS 18.

OTP AutoFill Fails to Distribute Code Across Multiple UITextFields on iOS 26.x
 
 
Q