Re: Different Dictionaries
Re: Different Dictionaries
- Subject: Re: Different Dictionaries
- From: Glenn Andreas <email@hidden>
- Date: Wed, 14 Jul 2004 16:03:22 -0500
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?
Print out the values of the two dictionary and see for yourself.
If a dictionary contains an object that can't be written do disk,
writing the dictionary to disk and reading it back in will result in
a second dictionary that isn't the same as the first (or possibly
result in something that is similar, but not quite identical, though
that's more an issue if you write to an xml format file).
If the initial dictionary is NULL, the descriptions of the two will
be equivalent (NULL), but the sending "isEqualToDictionary" will
result in 0 for a return value (since sending a message to NULL
always results in a zero scalar value), which would certainly be an
explanation for what you are seeing.
There are probably other possibilities, so toss in an NSLog(@"%@,
%@", memDict, readDict) and see what it actually says.
--
Glenn Andreas email@hidden
mondo blobbo, Cythera, Theldrow, oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
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.