• 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: How to clone a mutable dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to clone a mutable dictionary


  • Subject: Re: How to clone a mutable dictionary
  • From: Graham Cox <email@hidden>
  • Date: Fri, 24 Apr 2009 18:50:47 +1000


On 24/04/2009, at 6:44 PM, Jean-Daniel Dupas wrote:

NSMutableDictionary *newThing2 = [newThing mutableCopy];
[newThing2 setObject:foo forKey:bar];


This doesn't copy the contents of the dictionary, it only makes a mutable copy of the dictionary itself. If an object in the second dictionary is mutated, the same object in the first dictionary changes also. That is the OP's problem.

--Graham


_______________________________________________

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: How to clone a mutable dictionary
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >How to clone a mutable dictionary (From: Steve Cronin <email@hidden>)
 >Re: How to clone a mutable dictionary (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: How to clone a mutable dictionary
  • Next by Date: Best technology to use for overlays?
  • Previous by thread: Re: How to clone a mutable dictionary
  • Next by thread: Re: How to clone a mutable dictionary
  • Index(es):
    • Date
    • Thread