• 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: Different Dictionaries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: Different Dictionaries (From: Lorenzo <email@hidden>)

  • Prev by Date: Re: Different Dictionaries
  • Next by Date: Re: Basic Concepts
  • Previous by thread: Re: Different Dictionaries
  • Next by thread: Newbie: Apple in the UK
  • Index(es):
    • Date
    • Thread