Re: Understanding user defaults
Re: Understanding user defaults
- Subject: Re: Understanding user defaults
- From: Graham Cox <email@hidden>
- Date: Tue, 19 Mar 2013 10:17:22 +1100
On 19/03/2013, at 10:07 AM, Rick Mann <email@hidden> wrote:
> I'm a little bit surprised that I can't add my NSCoding-conforming object directly to NSUserDefaults. Why is this? Is it just a long-standing oversight of NSUserDefaults, or is there a technical reason why it doesn't work?
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.
--Graham
_______________________________________________
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