Using NSUserDefaults for Other Apps' Preferences
Using NSUserDefaults for Other Apps' Preferences
- Subject: Using NSUserDefaults for Other Apps' Preferences
- From: Jerry Krinock <email@hidden>
- Date: Tue, 26 Sep 2006 14:48:07 -0700
- Thread-topic: Using NSUserDefaults for Other Apps' Preferences
For the first 6 months I was writing Cocoa apps, I used the Carbon
CFPreferences functions because no one told me that "user defaults" was the
new word for "preferences".
Today, I discovered that "Persistent domain" means "preferences" too. Using
persistentDomainNames
persistentDomainForName:
removePersistentDomainForName:
setPersistentDomain:forName:
you can:
* get the com.company.app "domain names" for all other apps, also
called the "bundle identifier"
* read and write preferences for any app
* read all the prefs for any app, including yours
There is no other way to do the latter, and it is handy for including in
users' trouble reports.
The only thing that bothers me is that the documentations for these methods
states that the "value [of the argument Name:] should be equal to your
application's bundle identifier." However, it seems to work fine if I use a
another app's bundle identifier; it affects preferences for the other app.
Has anyone ever run into a problem with this?
Jerry Krinock
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden