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

Storing values in dictionary with their address as the key


  • Subject: Storing values in dictionary with their address as the key
  • From: "Carter R. Harrison" <email@hidden>
  • Date: Mon, 28 Jul 2008 14:13:28 -0400

Hey Everybody,

If I wanted to store an object in a dictionary and set its key as the object's memory address - how would I go about doing this?

Right now I'm doing this:

int i;
for (i = 0 ; i < 10 ; i++)
{
NSObject *myObject = [[NSObject alloc] init];
[dictionary setValue:myObject forKey:[NSString stringWithFormat:@"%x", &myObject]];
}


The above does seem to work, but the memory address that I get always seems to be the same.

Any ideas?
_______________________________________________

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: Manfred Schwind <email@hidden>
    • Re: Storing values in dictionary with their address as the key
      • From: Quincey Morris <email@hidden>
    • Re: Storing values in dictionary with their address as the key
      • From: "David Wilson" <email@hidden>
    • Re: Storing values in dictionary with their address as the key
      • From: Dave Carrigan <email@hidden>
  • Prev by Date: Re: DO Chat Example
  • Next by Date: Re: [Newbie] Communication between two Views?
  • Previous by thread: Re: How would you tell WebKit to keep all JavaScript popup windows on top/in front?
  • Next by thread: Re: Storing values in dictionary with their address as the key
  • Index(es):
    • Date
    • Thread