• 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: Retrieving "default" defaults after registerDefaults?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retrieving "default" defaults after registerDefaults?


  • Subject: Re: Retrieving "default" defaults after registerDefaults?
  • From: Doug Brown <email@hidden>
  • Date: Sun, 7 Apr 2002 14:36:12 -0700

Hi Matt,

Have you tried this?

[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"DefaultsKey"];

You could repeat that for each of your keys. I believe this deletes the user's chosen default, which would make the app go back to your default value.

If you wanted to remove all the defaults for your app, I think you could do:
- removePersistentDomainForName:@"yourBundleIdentifier"

I'm not totally sure and I'm definitely not an expert at Cocoa, so you might want to test this with a smaller app first to make sure it works.

Doug

On Sunday, April 7, 2002, at 01:49 PM, Matt Gemmell <email@hidden> wrote:

My question is, can I programmatically access the original "default" values
I registered, so that I can elegantly implement a "Factory Settings" button
in my preferences window? I want to retrieve the "default" values I
initially registered before reading the actual values the user had saved, so
that I can reset my app's settings to their factory state. I hope that makes
sense.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Retrieving "default" defaults after registerDefaults?
      • From: Matt Gemmell <email@hidden>
  • Prev by Date: Re: Icon for prefPane bundle?
  • Next by Date: Re: Icon for prefPane bundle?
  • Previous by thread: Re: Retrieving "default" defaults after registerDefaults?
  • Next by thread: Re: Retrieving "default" defaults after registerDefaults?
  • Index(es):
    • Date
    • Thread