Re: multiple profiles in preferences mechanism
Re: multiple profiles in preferences mechanism
- Subject: Re: multiple profiles in preferences mechanism
- From: Jerry Krinock <email@hidden>
- Date: Sat, 13 Apr 2013 08:56:23 -0700
On 2013 Apr 13, at 07:39, Nick Rogers <email@hidden> wrote:
> Is it possible to save the same set of preferences with different profiles in the system provided mechanism or do I have to come up with a scheme of my own (I guess I'd then be storing preferences in a plist in app bundle)?
I don't think that NSUserDefaults has that mechanism.
Using a "scheme of my own" is how the Google Chrome web browser supports multiple user profiles. Preferences are in Application Support. Each profile gets a subfolder in ~/Library/Application Support/Google/Chrome/, which contains, among many other things, a JSON "Preferences" file.
I'd also consider layering my profiles into NSUserDefaults somehow. To do this, you'll need to do lots of digging into and out of dictionaries with key paths such as "foo.profileName.bar". I've added a category to NSUserDefaults which creates and removes the required subdictionaries automatically, and also understands key path "arrays" such as {"foo", profileName, "bar"}. If you're interested,
https://github.com/jerrykrinock/CategoriesObjC/blob/master/NSUserDefaults+KeyPaths.h
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden