• 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: NSUserDefaults and objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults and objects


  • Subject: Re: NSUserDefaults and objects
  • From: "Alan Smith" <email@hidden>
  • Date: Mon, 13 Mar 2006 11:08:12 -0500

Okay. Yes, sorry, there was a question there.
How do I load a pref file that's not in the pref folder?

Thanks, Alan

On 3/12/06, j o a r <email@hidden> wrote:
>
>
> On 12 mar 2006, at 19.50, Alan Smith wrote:
>
> > I want to store an array of objects in the user defaults for
> > retrieval when
> > the program launches next time. The objects have two attributes, two
> > strings. One is the name of an app and the other the path of that
> > app. It
> > also has a couple of methods with it. But when I try setObject:
> > forKey:, or
> > whatever it is, it complains about the objects in the array. So is
> > there a
> > way to encode, or something, these objects so they'll go in and
> > come back
> > out as my object type?
>
> As is documented, NSUserDefaults only accepts "property list objects":
>
> <http://developer.apple.com/documentation/Cocoa/Conceptual/
> PropertyLists/index.html>
>
> You need to archive your objects if you want to persist them in user
> defaults:
>
> <http://developer.apple.com/documentation/Cocoa/Conceptual/Archiving/
> index.html>
>
> ...and unarchive them after you get them out from user defaults.
>
> > And one more thing. The dock has a file in
> > Dock/Contents/Resources/English.lproj/defaults.plist. I uses this
> > the first
> > times it's launched and adds apps to the dock according to the
> > arrays in
> > that plist file. I want my app to have the same thing. A previously
> > saved
> > pref file and store it in the apps bundle so that when it gets run on
> > someone elses computer it has a pref file to load, with apps in it.
>
> Great, so do it. Or wait, was there a question in there?
>
> <http://www.catb.org/~esr/faqs/smart-questions.html#explicit>
>
> You might get what you're looking for by using NSRegistrationDomain.
>
> j o a r
>
>
>
>
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSUserDefaults and objects
      • From: Chris Parker <email@hidden>
References: 
 >NSUserDefaults and objects (From: "Alan Smith" <email@hidden>)
 >Re: NSUserDefaults and objects (From: j o a r <email@hidden>)

  • Prev by Date: Re: Embedding image data
  • Next by Date: Array controller sorting vs ValueTransformers
  • Previous by thread: Re: NSUserDefaults and objects
  • Next by thread: Re: NSUserDefaults and objects
  • Index(es):
    • Date
    • Thread