Re: sharing defaults between screensaver bundle and application
Re: sharing defaults between screensaver bundle and application
- Subject: Re: sharing defaults between screensaver bundle and application
- From: email@hidden
- Date: Sun, 24 Feb 2002 18:07:28 -0800
nope, that's not it... the ScreenSaverDefaults subclass of
NSUserDefaults was using ByHost...
I worked around this by not using ScreenSaverDefaults at all and
manually setting the domain in both the .saver and the .app... (Thanks
to Jon Hendry for that tip!)
static NSUserDefaults *defs;
static NSMutableDictionary *defaults;
static NSString *bundleIdentifier;
defs = [NSUserDefaults standardUserDefaults];
bundleIdentifier = [[[NSBundle bundleForClass:self]
bundleIdentifier] retain];
defaults = [[defs persistentDomainForName:bundleIdentifier]
mutableCopy];
// change things in the defaults dictionary here.
[defs setPersistentDomain:defaults forName:bundleIdentifier];
[defs synchronize];
I had to write some categories on NSMutableDictionary to match the api
of NSUserDefaults, but it was straightforward.
(You can see the results at
http://www.versiontracker.com/moreinfo.fcgi?id=11375&db=mac )
On Sunday, February 24, 2002, at 05:57 PM, Ben Hines wrote:
At 8:02 PM -0800 2/23/02, email@hidden wrote:
Even MORE surprising is that when I go into the Applications
preference panel, and change them to something else... get this:
neither the Application NOR the screensaver reflects these changes!
Perhaps you are not calling [defaults synchronize] in the app or not
setting it in the app.
Generally don't worry about all the plist files. That's an
implementation detail. My guess is that the "ByHost" stuff is where
they live before you call synchronize, but i could be wrong. Don't pay
any attention to it.
-Ben
-- http://homepage.mac.com/bhines/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.