Tobonaut Tobonaut - 14 days ago 6
Objective-C Question

"defaults read com.apple.dock" as Objective C method

I try to read the plist / xml file which is behind the terminal commando:

defaults read com.apple.dock


I tried
NSUserDefaults
without success. Maybe you can help me. Thanks.

Answer

You can use CFPreferences, for example

CFStringRef orient = (CFStringRef) CFPreferencesCopyAppValue( CFSTR("orientation"), CFSTR("com.apple.dock") );
Boolean hidesIsValid = false;
Boolean hides = CFPreferencesGetAppBooleanValue( CFSTR("autohide"), CFSTR("com.apple.dock"), &hidesIsValid );
Comments