• 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: Jonathan del Strother <email@hidden>
  • Date: Thu, 1 Jul 2004 23:53:40 +0100

On 30 Jun 2004, at 2:30, Nick Zitzmann wrote:


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.



Thanks for the suggestion - that seems to be working nicely

Jon
_______________________________________________
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.


  • Prev by Date: Avoiding temp file
  • Next by Date: Re: Strategy to split up large class files?
  • Previous by thread: Re: Avoiding temp file
  • Next by thread: Re: Strategy to split up large class files?
  • Index(es):
    • Date
    • Thread