textField.shouldChangeCharactersIn not called with Braille Screen Input

I’m working on an app that uses accessibility. When the user clicks in a UITextField and writes a letter, the textField.shouldChangeCharactersIn methods gets called. This happens without problems when voiceOver is switched on or off. But if the users turns on the Braille Screen Input, the method textField.shouldChangeCharactersIn doesn’t get called.


Instead an error gets logged out:

[User Defaults] Couldn't write value for key VoiceOverHandwritingWasNativeAutocorrectEnabled in CFPrefsPlistSource<0x1d4107860> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access, switching to read-only


Can somebody explain what this means?


It can be reproduced easily with:


import UIKit


class ViewController: UIViewController, UITextFieldDelegate {


var text: UITextField?


override func viewDidLoad() {

super.viewDidLoad()

text = UITextField(frame: CGRect(x: 20.0, y: 150.0, width: 200.0, height: 30.0))

text?.delegate = self;

text?.backgroundColor = .gray

self.view.addSubview(text!)

}


func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {


print("replacementString : \(string)")

return true

}

}