Mike Fulton
Mike Fulton

Reputation: 918

Changing OS X Defaults

I am wanting to read and otherwise manipulate settings in the com.apple.iTunes plist, but the info I'm finding about using the NSUserDefaults class doesn't seem to be telling me what I want to know. Is that maybe not the right place to be looking?

Basically what I need to know is, what is the programatic equivalent of the shell commands:

defaults read {plist} {key}

defaults write {plist} {key} {options} {value}

defaults delete {plist} {key}

Upvotes: 0

Views: 67

Answers (1)

Noah Witherspoon
Noah Witherspoon

Reputation: 57149

The API you’re looking for is the Core Foundation neighbor to NSUserDefaults, CFPreferences; the methods in question would be CFPreferencesCopyAppValue and CFPreferencesSetAppValue. There’s more information in the Preferences Utilities Reference. Keep in mind that sandboxing might prevent your app from affecting other apps’ settings.

Upvotes: 1

Related Questions