• 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: Storing values in dictionary with their address as the key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing values in dictionary with their address as the key


  • Subject: Re: Storing values in dictionary with their address as the key
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Tue, 29 Jul 2008 00:23:54 +0200


Le 29 juil. 08 à 00:09, Charles Steinman a écrit :

--- On Mon, 7/28/08, Carter R. Harrison <email@hidden> wrote:

Actually now that I'm looking at this more closely,
NSDictionary is
expecting an NSString for the key when inserting a value.
Your
example uses an NSValue for the key - the compiler is
throwing a
warning for this one..

That's because setValue:forKey: is a KVC method. The NSDictionary method, which accepts any object (though it may prefer strings -- I don't know), is setObject:forKey.


Cheers,
Chuck

What about using CFDictionary ? You can create a dicitonary with a callback that support address (NULL for example).


WARNING: Just in case, there is a major warning here. You should avoid NS/CF bridge when inserting/removing value in a dictionary as the semantic is not the same. NSDictionary always try to copy the key whatever the calback is (or at least did it the last time I try).

_______________________________________________

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: Storing values in dictionary with their address as the key
      • From: "Adam R. Maxwell" <email@hidden>
References: 
 >Re: Storing values in dictionary with their address as the key (From: Charles Steinman <email@hidden>)

  • Prev by Date: Re: Distributed Objects "connection went invalid while waiting for a reply"
  • Next by Date: Re: Repositioning a content view w/in a window
  • Previous by thread: Re: Storing values in dictionary with their address as the key
  • Next by thread: Re: Storing values in dictionary with their address as the key
  • Index(es):
    • Date
    • Thread