Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

setting layered user defaults?



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.