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

Re: NSUersDefaults and setting for a specific domain


  • Subject: Re: NSUersDefaults and setting for a specific domain
  • From: Chris Parker <email@hidden>
  • Date: Tue, 26 Sep 2006 13:35:56 -0700


On Sep 26, 2006, at 1:22 PM, Stephen Deken wrote:

There is, but it means dropping "down" to CFPreferences. Key/value
pairs set via CFPreferences are available through NSUserDefaults and
vice-versa.

Couldn't he also do something like:

 NSUserDefaults *otherUserDefaults = [[NSUserDefaults alloc] init];
 [otherUserDefaults addSuiteName:@"com.mycompany.myapp"];

And then use otherUserDefaults as a normal NSUserDefaults object?

Not in front of a mac at the moment, or I'd have tested this before sending it.

That does something slightly different which may or may not be desirable.


Using addSuiteName: adds the requested preferences domain with the provided name to the application's search list.

After the call to addSuiteNamed:, when asking for the value for a key, that key could be read as if it were part of the application's preferences itself (i.e. just using -[NSUserDefaults objectForKey:]). If the application has a key which is the same as the bundle (in this case), then the application's key will "win out" in the search list.

In order to set the key in the bundle's preferences, you'd still have to use CFPreferences or the NSUserDefaults code the original poster supplied.

.chris

--
Chris Parker
Cocoa Frameworks Engineer
Apple Computer, Inc.


_______________________________________________ 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: 
 >NSUersDefaults and setting for a specific domain (From: David Alter <email@hidden>)
 >Re: NSUersDefaults and setting for a specific domain (From: Chris Parker <email@hidden>)
 >Re: NSUersDefaults and setting for a specific domain (From: "Stephen Deken" <email@hidden>)

  • Prev by Date: Re: Accuracy of timestamping streamed data (code included - long)
  • Next by Date: 10.3.9 sdk
  • Previous by thread: Re: NSUersDefaults and setting for a specific domain
  • Next by thread: Re: NSUersDefaults and setting for a specific domain
  • Index(es):
    • Date
    • Thread