Re: Different Dictionaries
Re: Different Dictionaries
- Subject: Re: Different Dictionaries
- From: Shawn Erickson <email@hidden>
- Date: Wed, 14 Jul 2004 14:08:00 -0700
On Jul 14, 2004, at 1:31 PM, Lorenzo wrote:
Hi,
thanks for your prompt reply. But I think you lost a detail in my code.
I save an original dict to a file, then I immediately load that file
in a
new dict and compare this new dict with the original dict, and they are
different! So that's strange. And even more strange, if I compare the
string
descriptions of the two dicts, they are equal!
NSString *memString = [memDict description];
NSString *readString = [readDict description];
BOOL areEqual = [memString isEqualToString:readString];
Any idea?
Well your archived then unarchived dictionary contains different object
instances then the original. If isEqual is the default one for any one
of the contained objects then comparison would be pointer based and
hence would fail.
Make sure all of your contained objects implement isEqual as needed to
compare distinct instances that should be considered the same.
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.