Re: NSUserDefaults for another Application
Re: NSUserDefaults for another Application
- Subject: Re: NSUserDefaults for another Application
- From: Keith Duncan <email@hidden>
- Date: Fri, 27 Jul 2007 17:03:25 +0100
Call -synchronize after calling -setPersistentDomain:forName: and it
should work as you expect
That doesn't seem to working either.
The following code:
NSLog(@"pre-save:\n%@", _prefs);
[[NSUserDefaults standardUserDefaults] setPersistentDomain:_prefs
forName:[[self bundle] bundleIdentifier]];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"post-save:\n%@", [[NSUserDefaults standardUserDefaults]
persistentDomainForName:[[self bundle] bundleIdentifier]]);
Produces the following output. As you can see the key calendarName is
NOT present in the prefs dictionary prior to saving via
NSUserDefaults, then pulling the dictionary out again using
persistentDomainForName: it is once again present.
pre-save:
{
advancedAlarms = (
);
alarmDays = {
friday = 1;
monday = 1;
saturday = 0;
sunday = 0;
thursday = 1;
tuesday = 1;
wednesday = 1;
};
alarmEnabled = 0;
alarmTime = 0001-01-01 07:30:00 +0100;
backupAlarmName = Buzzer;
finalVolume = 50;
incrementMinutes = 10;
initialVolume = 50;
libraryPath = "/Users/keith/Music/iTunes/iTunes Music Library.xml";
playlist = "Morning Songs";
repeatEnabled = 0;
shuffleEnabled = 0;
snoozeDuration = 10;
snoozeEnabled = 1;
systemVolume = 3.5;
volumeIncreaseEnabled = 0;
}
post-save:
{
advancedAlarms = (
);
alarmDays = {
friday = 1;
monday = 1;
saturday = 0;
sunday = 0;
thursday = 1;
tuesday = 1;
wednesday = 1;
};
alarmEnabled = 0;
alarmTime = 0001-01-01 07:30:00 +0100;
backupAlarmName = Buzzer;
calendarName = "Home";
finalVolume = 50;
incrementMinutes = 10;
initialVolume = 50;
libraryPath = "/Users/keith/Music/iTunes/iTunes Music Library.xml";
playlist = "Morning Songs";
repeatEnabled = 0;
shuffleEnabled = 0;
snoozeDuration = 10;
snoozeEnabled = 1;
systemVolume = 3.5;
volumeIncreaseEnabled = 0;
}
I've tried removePersistentDomainForName: prior to setting and
synchronizing but that didn't work either, it makes no sense whatsoever!
- Keith
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden