• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSUserDefaults for another Application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSUserDefaults for another Application (From: Keith Duncan <email@hidden>)
 >Re: NSUserDefaults for another Application (From: Benjamin Miller <email@hidden>)
 >Re: NSUserDefaults for another Application (From: Keith Duncan <email@hidden>)
 >Re: NSUserDefaults for another Application (From: Michael Nickerson <email@hidden>)

  • Prev by Date: Re: NSTimers and sleeping mac's
  • Next by Date: Re: Is there an API which allow to manipulate Safari Bookmarks?
  • Previous by thread: Re: NSUserDefaults for another Application
  • Next by thread: Simple Bluetooth Question
  • Index(es):
    • Date
    • Thread