Created
October 11, 2012 13:24
-
-
Save angelolloqui/3872250 to your computer and use it in GitHub Desktop.
Activate Accesibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *appSupportLocation = @"/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport"; | |
NSDictionary *environment = [[NSProcessInfo processInfo] environment]; | |
NSString *simulatorRoot = [environment objectForKey:@"IPHONE_SIMULATOR_ROOT"]; | |
if (simulatorRoot) { | |
appSupportLocation = [simulatorRoot stringByAppendingString:appSupportLocation]; | |
} | |
void *appSupportLibrary = dlopen([appSupportLocation fileSystemRepresentation], RTLD_LAZY); | |
CFStringRef (*copySharedResourcesPreferencesDomainForDomain)(CFStringRef domain) = dlsym(appSupportLibrary, "CPCopySharedResourcesPreferencesDomainForDomain"); | |
if (copySharedResourcesPreferencesDomainForDomain) { | |
CFStringRef accessibilityDomain = copySharedResourcesPreferencesDomainForDomain(CFSTR("com.apple.Accessibility")); | |
if (accessibilityDomain) { | |
CFPreferencesSetValue(CFSTR("ApplicationAccessibilityEnabled"), kCFBooleanTrue, accessibilityDomain, kCFPreferencesAnyUser, kCFPreferencesAnyHost); | |
CFRelease(accessibilityDomain); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment