• 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: Weird behavior in NSMutableDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird behavior in NSMutableDictionary


  • Subject: Re: Weird behavior in NSMutableDictionary
  • From: Harilaos Skiadas <email@hidden>
  • Date: Sat, 18 Dec 2004 02:44:56 -0800 (PST)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

--- Thomas Lachand-Robert <email@hidden> wrote:

>
> Le 18 déc. 04, à 05:10, Harilaos Skiadas a écrit :
>
> > What I want to do is add anItem as an object to
> aDict,
> > with key the string that is the object
> corresponding
> > the key @"aKey" in anItem. I would have thought
> that
> > the following would work:
> > [aDict setValue:anItem forKey:[anItem
> > valueForKey:@"aKey"]];
> > instead, I had to use:
> > [aDict setValue:anItem forKey:[[anItem
> > valueForKey:@"aKey"] copy];
> >
> >
>
> You are confusing -valueForKey with -objectForKey
> and -setValueForKey
> with -setObjectForKey. Check again the documentation
> on dictionaries.

>From the docs on NSMutableDictionary:

>- (void)setValue:(id)value forKey:(NSString *)key
>
>Adds an entry to the receiver using setObject:forKey:
with the >specified value and key. If value is nil it
instead attempts to remove >the specified key using
removeObjectForKey:.

and from NSDictionary:
>- (id)valueForKey:(NSString *)key
>
>Returns the result of sending objectForKey: to the
receiver

So it seems to me that as long as the value is not
nil, which it isn't in my case, there is no
difference. Am I missing something?

>
> Yours,
>
> Thomas Lachand-Robert
> ********************** email@hidden
> << Et le chemin est long du projet à la chose. >>
> Molière, Tartuffe.
>

Best,
Haris



__________________________________
Do you Yahoo!?
Dress up your holiday email, Hollywood style. Learn more.
http://celebrity.mail.yahoo.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Weird behavior in NSMutableDictionary
      • From: Jeremy Dronfield <email@hidden>
References: 
 >Re: Weird behavior in NSMutableDictionary (From: Thomas Lachand-Robert <email@hidden>)

  • Prev by Date: Re: Weird behavior in NSMutableDictionary
  • Next by Date: NSSearchField...Solution
  • Previous by thread: Re: Weird behavior in NSMutableDictionary
  • Next by thread: Re: Weird behavior in NSMutableDictionary
  • Index(es):
    • Date
    • Thread