• 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: Steven Kramer <email@hidden>
  • Date: Sat, 18 Dec 2004 10:38:17 +0100


Op 18-dec-04 om 5:10 heeft Harilaos Skiadas het volgende geschreven:

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 probably overreleasing 'aKey' from 'anItem' somewhere. Try [[anItem valueForKey: @"aKey"] retain] to see if this also fixes the problem. Then you know you have a retain bug somewhere. Also search for zombie debugging with Cocoa. BTW You should of course (auto)release the copy you made after valueForKey!


Regards,

Steven Kramer

--
email@hidden
http://sprintteam.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: Harilaos Skiadas <email@hidden>
References: 
 >Weird behavior in NSMutableDictionary (From: Harilaos Skiadas <email@hidden>)

  • Prev by Date: Re: NSAlert strategy advice
  • Next by Date: Re: Bindings problem...
  • Previous by thread: Weird behavior in NSMutableDictionary
  • Next by thread: Re: Weird behavior in NSMutableDictionary
  • Index(es):
    • Date
    • Thread