Re: Understanding user defaults
Re: Understanding user defaults
- Subject: Re: Understanding user defaults
- From: Rick Mann <email@hidden>
- Date: Mon, 18 Mar 2013 16:21:23 -0700
On Mar 18, 2013, at 16:17 , Graham Cox <email@hidden> wrote:
> Because the defaults are stored as a plist, so the objects written there have to be property list objects. I agree, it's a bit annoying that this isn't handled transparently. You have to convert those objects to NSData, one way to do that is to archive them individually and save the archive data as the object, but anything else that allows them to be described as a plist object is fine, e.g. a string.
It seems like an NSArchiver subclass could call -encodeWithCoder: to create a dictionary that could live in a plist file (as opposed to creating an NSData), and it could easily be used transparently. The advantage to this is twofold: you avoid a couple extra lines in your code each time you access the pref, and the prefs plist is human-readable.
--
Rick
_______________________________________________
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