• 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: Colors and NSUserDefaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Colors and NSUserDefaults


  • Subject: Re: Colors and NSUserDefaults
  • From: Jeremy Dronfield <email@hidden>
  • Date: Mon, 8 Jul 2002 18:30:04 +0100

I couldn't get it to work. The data seemed to save all right, but gave me a
-initForReadingWithData: nil argument error on opening.
-J.
On Monday, July 8, 2002, at 09:19 am, Matt Judy wrote:

You should archive the color into data first. Something along these lines is effective:

[[NSUserDefaults standardUserDefaults] setObject:[NSArchiver archivedDataWithRootObject:myColor] forKey:@"savedColor"];

To restore:

myColor = [NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] dataForKey:@"savedColor"]]

--Matt

Jeremy Dronfield wrote:
I'm trying to put a colour value into my NSUserDefaults object.
_______________________________________________
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: Colors and NSUserDefaults
      • From: Paul Ferguson <email@hidden>
References: 
 >Re: Colors and NSUserDefaults (From: Matt Judy <email@hidden>)

  • Prev by Date: Re: Starting Cocoa development - Developing for Jaguar
  • Next by Date: Re: Non-standard Cocoa RTF Unicode encoding?
  • Previous by thread: Re: Colors and NSUserDefaults
  • Next by thread: Re: Colors and NSUserDefaults
  • Index(es):
    • Date
    • Thread