discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coping a NSMutableDictionary


From: Richard Frith-Macdonald
Subject: Re: Coping a NSMutableDictionary
Date: Mon, 24 Nov 2008 22:40:44 +0000


On 24 Nov 2008, at 22:10, Germán Arias wrote:

Hi, I am trying to copy a NSMutableDictionary with

newDictionary = [oldDictionary mutableCopy] ;

but, isn't a copy. Any change in newDictionary affect the oldDictionary. I want a new completely copy of oldDictionary. Is this possible?

I think it's likely that there is a bug in your code and you are using the same dictionary twice, since mutable copy works reliably for everyone else. Alternatively, perhaps you are really saying that you want to make copies of the objects in a dictionary rather than a copy of the dictionary itsself. If that's what you mean, then you probably want to use the -initWithDictionary:copyItems: method to initialise a new dictionary so that it contains copies of the objects in another dictionary.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]