Re: Understanding user defaults
Re: Understanding user defaults
- Subject: Re: Understanding user defaults
- From: Jens Alfke <email@hidden>
- Date: Mon, 18 Mar 2013 16:46:09 -0700
On Mar 18, 2013, at 4:21 PM, Rick Mann <email@hidden> wrote:
> 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.
It wouldn’t be human-readable. NSArchiver doesn’t produce readable output. Even if you made a version whose output was a tree of directories, it would still be pretty unreadable due to all the metadata in it. (After all, XML is “human-readable”, but have you ever looked at the XML output of NSArchiver? It’s really hairy.)
User defaults are for small prefs, things like strings or numbers or maybe colors. I agree with Kyle that it’s not appropriate to store large things in them. Put a file into your Application Support directory for that, instead.
—Jens
_______________________________________________
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