textField.shouldChangeCharactersIn not called with Braille Screen Input

Originator:mayerubique
Number:rdar://42417164 Date Originated:August 23 2018
Status: Resolved:
Product:OS + SDK | Accessibility Product Version:
Classification: Reproducible:yes
 
Summary:

I’m working on different apps that use accessibility. When the user clicks in a UITextField and writes a letter, the textField.shouldChangeCharactersIn method gets called. This happens without problems when voiceover is switched on or off. But if the user 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



Steps to Reproduce:

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
    }
}


Expected Results:

The string/letter gets printed, even when using braille input screen.


Actual Results:

Couldn't write value for key VoiceOverHandwritingWasNativeAutocorrectEnabled in CFPrefsPlistSource<0x1d0113290> (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

is printed out, but not the string/letter

Version/Build:

iOS11 and older

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!