Sunday, 11 August 2013

ERROR ADDING TO NSMUTABLE DICTIONARY

ERROR ADDING TO NSMUTABLE DICTIONARY

This is driving me nuts.
have an two mutable dictionaries
I'm adding to the first mutable dictionary an object (a second mutable
dictionary) with a unique KEY value
then I change the second mutable dictionary to contain different keys and
values
and add it to the first mutable dictionary with a DIFFERENT KEY
The problem is, the first mutable dictionary now contains two dictionaries
with DIFFERENT KEYS but the values inside both of them are exactly the
SAME!
In the first pass everyting is perfect
FIRST MUTABLE DICTIONARY NOW CONTAINS bennyKEY Dictionary (2 items)
FirstName String benny LastName String goodman
That's ok, now I change the 2nd dictionary to contain FirstName john and
LastName doe and add it to the first dictionary with the key johnKEY and I
get this result
FIRST MUTABLE DICTIONARY NOW CONTAINS johnKEY Dictionary (2 items)
FirstName String john LastName String doe
bennyKEY Dictionary (2 items) FirstName String john LastName String doe
What can I do to get bennyKEY to stay with the earlier values after adding
the johnKEY
Any help would be greatly appreciated

No comments:

Post a Comment