• 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 Croaks on Dictionary Containing NSNumber as Key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults Croaks on Dictionary Containing NSNumber as Key


  • Subject: Re: NSUserDefaults Croaks on Dictionary Containing NSNumber as Key
  • From: Clark Cox <email@hidden>
  • Date: Fri, 11 Dec 2009 23:21:36 -0800

On Fri, Dec 11, 2009 at 11:10 PM, Jerry Krinock <email@hidden> wrote:
> Sorry for the wonky subject.  It's easier to explain in code:
>
> NSNumber* innerKey = [NSNumber numberWithInt:0] ;
> NSDictionary* dic = [NSDictionary dictionaryWithObject:@"Hello"
>                                                forKey:innerKey] ;
> [[NSUserDefaults standardUserDefaults] setObject:dic
>                                          forKey:@"outerKey"] ;
>
> Result:
>
> *** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '{
>    0 = Hello;
> }' of class 'NSCFDictionary'.

The message printed is unfortunate, as it doesn't really tell you what
is wrong (please file a bug). It's fine to have numbers as keys in
dictionaries; however keys property lists (and therefore in user
defaults) must be strings.

--
Clark S. Cox III
email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSUserDefaults Croaks on Dictionary Containing NSNumber as Key
      • From: Jerry Krinock <email@hidden>
References: 
 >NSUserDefaults Croaks on Dictionary Containing NSNumber as Key (From: Jerry Krinock <email@hidden>)

  • Prev by Date: NSUserDefaults Croaks on Dictionary Containing NSNumber as Key
  • Next by Date: Data-Driven Animation
  • Previous by thread: NSUserDefaults Croaks on Dictionary Containing NSNumber as Key
  • Next by thread: Re: NSUserDefaults Croaks on Dictionary Containing NSNumber as Key
  • Index(es):
    • Date
    • Thread