• 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: nsuserdefaults and bools.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nsuserdefaults and bools.


  • Subject: Re: nsuserdefaults and bools.
  • From: Bill Cheeseman <email@hidden>
  • Date: Sat, 19 Apr 2003 12:55:16 -0400

on 03-04-19 11:28 AM, Nick Zitzmann at email@hidden wrote:

> On Friday, April 18, 2003, at 07:11 PM, Francisco Tolmasky wrote:
>
>> I know I can set a bool using setBool:forKey: in NSUserDefaults, but
>> when I register my defaults, how do I do this within the Dictionary I
>> pass in. In other words, how do I store the bool in my dictionary, is
>> it similar to the way you archive bools?
>
> You can use NSNumber as a wrapper to store a BOOL (or any other number)
> into a dictionary. Then, when you store the dictionary into the user
> defaults, the boolean value will be typedef'd correctly. Check the
> NSNumber documentation for more information...

I was doing it this way, successfully, but I just changed it to the @"YES"
method suggested in an earlier message in light of the documentation for
NSUserDefaults setBool:forKey: and boolForKey:, both of which indicate that
NSUserDefaults stores it as a string instead of an NSNumber. This is
successful, too. So I guess both work, but @"YES" is simpler and seems more
in keeping with the NSUserDefaults documentation.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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.

References: 
 >Re: nsuserdefaults and bools. (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Convert an NSAttributedString to HTML
  • Next by Date: Re: NSTask from a foundation tool?
  • Previous by thread: Re: nsuserdefaults and bools.
  • Next by thread: Convert an NSAttributedString to HTML
  • Index(es):
    • Date
    • Thread