• 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
setting layered user defaults?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setting layered user defaults?


  • Subject: setting layered user defaults?
  • From: Mark Dawson <email@hidden>
  • Date: Fri, 29 Apr 2005 21:33:46 -0700

I wasn't sure of how to set a user default that is part of layers of dictionaries:

What I'm not sure how to do is set the "UnitsKey" (which isn't unique) and is inside the Tool_XXX_DefaultKey (is unique) dict which is inside the Tool_DefaultKey dict (is unique). What I'm not clear about is whether the below code is getting a local copy of a dictionary, or whether the NSUserDefaults database is being updated by my final set. Am I doing this correctly, or is there a more correct way of doing things? Thanks!


Do I do the following: NSUserDefaults *usrD=[NSUserDefaults standardUserDefaults];

][[usrD objectForKey: ToolDefaults] // <<- returns an NSDictionary object
objectForKey: Tool_XXX_DefaultKey] // <<--returns another NSDictionary object
setObject: [NSNumber numberWithInt:defaultUnits] forKey: UnitsKey]] // <<-- now set that object



If I register the following : NSDictionary *dict= [NSDictionary dictionaryWithObjectsAndKeys: createToolsDictionaryFromDoc(&ToolDefaults), Tool_DefaultKey, ..., nil];

Where
createToolsDictionaryFromDoc
does a a return NSDictionary dictionaryWithObjectsAndKeys:
createTools_XXX_DictionaryFromDoc(&ToolDefaults), Tool_XXX_DefaultKey,
...,
nil];


and
   createTools_XXX_DictionaryFromDoc
       does a  return [NSDictionary dictionaryWithObjectsAndKeys:
			[NSNumber numberWithInt:defaultUnits],	UnitsKey,
			....
			nil];

_______________________________________________
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


  • Prev by Date: Re: Apple's Help Viewer
  • Next by Date: Tiger X tools crash
  • Previous by thread: NSView scrolling (NSTextView)
  • Next by thread: Tiger X tools crash
  • Index(es):
    • Date
    • Thread