Trying programmatically do what the \'defaults write\' command does in OS X. I can\'t seem to figure out how to get the correct preferences dictionary for the domain I\'m l
The only problem is your line here:
[dockDict setValue:YES forKey:@"mcx-expose-disabled"];
This should be
[dockDict setValue:[NSNumber numberWithBool:YES] forKey:@"mcx-expose-disabled"];
Objective-C doesn't "auto-box" values of primitive types into objects.
And, the compiler should have given you a warning saying that you can't pass YES
to setValue:forKey:
. You should inspect every warning the compiler emits! That's what the warnings are for!
It might be easier to use Core Foundation for this, e.g.,
CFPreferencesSetAppValue( CFSTR("mcx-expose-disabled"), kCFBooleanTrue, CFSTR("com.apple.dock") );
CFPreferencesAppSynchronize( CFSTR("com.apple.dock") );