• 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
NSUersDefaults and setting for a specific domain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUersDefaults and setting for a specific domain


  • Subject: NSUersDefaults and setting for a specific domain
  • From: David Alter <email@hidden>
  • Date: Tue, 26 Sep 2006 13:09:44 -0700

I'm working on a plugin. If I use NSUersDefaults to get and set the prefs, it ends up making changes in the host applications prefs file. I wanted to make sure the plugin prefs end up in it's own prefs file. I was wondering if there was an easy way to insure that the prefs are set for the correct domain.

I can get the data for the correct domain by doing the following

id value = [[[NSUserDefaults standardUserDefaults] persistentDomainForName: @"com.mycompany.myplugin"]
objectForKey: key];


And I could set it by doing...

NSMutableDictionary * defaults = [NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults] persistentDomainForName: @"com.mycompany.myplugin"]];
[defaults setObject: value forKey:key];
[[NSUserDefaults standardUserDefaults] setPersistentDomain:defaults forName:@"ccom.mycompany.myplugin"];



But I'm guessing there is a cleaner way to do this.

Any ideas.

thank you for the help.

-dave

_______________________________________________
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


  • Follow-Ups:
    • Re: NSUersDefaults and setting for a specific domain
      • From: Chris Parker <email@hidden>
  • Prev by Date: Re: Problem with relationships in Core Data
  • Next by Date: Re: NSUersDefaults and setting for a specific domain
  • Previous by thread: Questions About Core Image Filters
  • Next by thread: Re: NSUersDefaults and setting for a specific domain
  • Index(es):
    • Date
    • Thread