On 19/03/2013, at 10:07 AM, Rick Mann <[email protected]> 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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to