Re: Saving arrays with NSUserDefaults?
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.