Hmm, if I open Library / Preferences / com.apple.Accessibility.plist and change ApplicationAccessibilityEnabled from false to true, then it will work. (This path is in ~ / Library / Application Support / iPhone Simulator /)
I tried adding this to the beginning of main ():
CFPreferencesSetAppValue(@"AccessibilityEnabled", kCFBooleanTrue, @"com.apple.Accessibility"); CFPreferencesSetAppValue(@"ApplicationAccessibilityEnabled", kCFBooleanTrue, @"com.apple.Accessibility"); CFPreferencesAppSynchronize(@"com.apple.Accessibility");
but it didn’t work. (He wrote a file for applications /{UUID►/Library/Preferences/com.apple.Accessibility.plist)
EDIT: after passing the UIKit code, a call that determines whether the accessibility function is enabled,
CFPreferencesGetBooleanValue(@"ApplicationAccessibilityEnabled", @"/Users/sam/Library/Application Support/iPhone Simulator/User/Library/Preferences/com.apple.Accessibility", NULL);
Pay attention to the fancy application key, I'm still not sure where this value comes from (my knowledge of assembly 386 is very weak!), But I can pass this key to CFPreferencesSetAppValue, and it works, at least on the simulator (I do not have access to the actual device at the moment).
It will also add application accessibility to all applications (since it writes it to the global plist). I can set the flag from main () if, after starting the application, the value should be returned false.
Sam mccall
source share