• 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 - When is it written to disk?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults - When is it written to disk?


  • Subject: Re: NSUserDefaults - When is it written to disk?
  • From: Larry Fransson <email@hidden>
  • Date: Fri, 3 Dec 2004 09:57:07 -0800


On Dec 3, 2004, at 06:17, Jeremy French wrote:

When are UserDefaults written to the plist document?

As you have noted, it happens when the application quits after changes have been made to the registered defaults , or sooner if you send a -synchronize message to the appropriate NSUserDefaults object. The docs for the -synchronize method seem to indicate that prefs get synchronized periodically, but I have no idea what that period might be.


* Why doesn't the act of simply opening the application and then quitting it create the preference file?

Why should it? Why do you want to do unnecessary work? If you have a set of registered defaults and don't make any changes to them, what's the sense in recording them? When the app starts again, you have to read in the prefs from the file, and it's just not necessary to read in prefs that already agree with the registered defaults. The prefs file is for recording user preferences that are different from the app's registered defaults. Also note that if you make a change to a pref that has been recorded in the prefs file and change it to match the registered default, that entry will be removed from the prefs file when the prefs are synchronized.


Larry Fransson
Seattle, WA

_______________________________________________
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


References: 
 >NSUserDefaults - When is it written to disk? (From: Jeremy French <email@hidden>)

  • Prev by Date: NSString initWithData: NSUTF8StringEncoding - returns 'nil'
  • Next by Date: Re: NSString initWithData: NSUTF8StringEncoding - returns 'nil'
  • Previous by thread: NSUserDefaults - When is it written to disk?
  • Next by thread: Re: NSUserDefaults - When is it written to disk?
  • Index(es):
    • Date
    • Thread