• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Understanding user defaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Understanding user defaults
      • From: Jens Alfke <email@hidden>
    • Re: Understanding user defaults
      • From: Graham Cox <email@hidden>
References: 
 >Understanding user defaults (From: Rick Mann <email@hidden>)
 >Re: Understanding user defaults (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Understanding user defaults
  • Next by Date: Re: Understanding user defaults
  • Previous by thread: Re: Understanding user defaults
  • Next by thread: Re: Understanding user defaults
  • Index(es):
    • Date
    • Thread