iOS 14.3 UITextField leak?

Why is the UIKeyboard implementation still holding a reference to this UITextField, thus keeping it from being deallocated?

The memory debugger shows:

UIKeyboardImpl -> UIKBAutofillController -> NSMutableDictionary -> NSMutable...(Storage) -> UITextField

Any idea what's going on there?

Answered by Ana0209 in 670571022
It seems to disappear if I set:

Code Block
textField.autocorrectionType = UITextAutocorrectionType.no


I tried that because of the UIKBautofillController pointing to the field in the memory debugger.
I cannot offer any help, but I have the same issue. I noticed that it appears when I switch the view while the cursor is still in the text field. I tried adding resignFirstResponder in different ways, it did not help.
Accepted Answer
It seems to disappear if I set:

Code Block
textField.autocorrectionType = UITextAutocorrectionType.no


I tried that because of the UIKBautofillController pointing to the field in the memory debugger.

If anyone (else) is coming across this issue with their custom UITextInput control. The following work around will work (assuming you don't need autocorrect):

var autocorrectionType: UITextAutocorrectionType {
    get { .no }
    set { fatalError() }
}

iOS 17.4.1 still have this issue

iOS 14.3 UITextField leak?
 
 
Q