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