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

Saving arrays with NSUserDefaults?


  • Subject: Saving arrays with NSUserDefaults?
  • From: Jonathan del Strother <email@hidden>
  • Date: Tue, 29 Jun 2004 23:53:55 +0100

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
{
NSString* name;
float intensity;
float sensitivity;
float fade;
float zoom;
float zoomRotation;
int numLines;
float r1,g1,b1;
float r2,g2,b2;
bool smooth;
bool glow;
bool cycle;
bool sharpOverlay;
int scaleSystem;
};
@end;


When I try to set the object in the preferences, I get this in the
console:

-[NSUserDefaults setObject:forKey:]: Attempt to insert non-property
value '<CFArray 0x54afe70 [0xa01900e0]>{type = immutable, count = 9,
values = (
0 : <Preset: 0x5492540>
1 : <Preset: 0x54b7960>
2 : <Preset: 0x54b6cc0>
3 : <Preset: 0x54924d0>
4 : <Preset: 0x54912f0>
5 : <Preset: 0x54b78e0>
6 : <Preset: 0x54b0860>
7 : <Preset: 0x54b7260>
8 : <Preset: 0x54afdb0>
)}' of class 'NSCFArray'.


Any ideas what I'm doing wrong?

Thanks,
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.


  • Follow-Ups:
    • Re: Saving arrays with NSUserDefaults?
      • From: "Louis C. Sacha" <email@hidden>
    • Re: Saving arrays with NSUserDefaults?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: NSTextViews with embedded pictures and vertical alignment
  • Next by Date: Re: Saving arrays with NSUserDefaults?
  • Previous by thread: Using GCContextFillRect() vs. NSBezierPath's class methods
  • Next by thread: Re: Saving arrays with NSUserDefaults?
  • Index(es):
    • Date
    • Thread