• 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: Saving arrays with NSUserDefaults?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving arrays with NSUserDefaults?


  • Subject: Re: Saving arrays with NSUserDefaults?
  • From: Nick Zitzmann <email@hidden>
  • Date: Tue, 29 Jun 2004 19:30:21 -0600

On Jun 29, 2004, at 4:53 PM, Jonathan del Strother wrote:

I'm having trouble saving an array into NSUserDefaults.

[ [NSUserDefaults standardUserDefaults] setObject:presets
forKey:@"GLPresets"];

'presets' is an NSMutableArray consisting of several of these:

@interface Preset : NSObject

The only objects that can be stored in NSUserDefaults are NSString, NSData, NSNumber, NS(Calendar)Date, NSArray, and NSDictionary. If you want to store these Preset objects inside the user defaults, then you will need to make the Preset class compliant with the NSCoding protocol, and then use NS(Keyed)Archiver & NS(Keyed)Unarchiver to store & extract the objects in/from the array.

You can probably find out more about NSCoding by searching the ADC site.

Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Saving arrays with NSUserDefaults? (From: Jonathan del Strother <email@hidden>)

  • Prev by Date: Saving arrays with NSUserDefaults?
  • Next by Date: [ANN] Free NSValueTransformer classes.
  • Previous by thread: Saving arrays with NSUserDefaults?
  • Next by thread: Re: Saving arrays with NSUserDefaults?
  • Index(es):
    • Date
    • Thread