• 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
isEqualToArray: returning NO for equal arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

isEqualToArray: returning NO for equal arrays


  • Subject: isEqualToArray: returning NO for equal arrays
  • From: Rosyna <email@hidden>
  • Date: Thu, 2 Nov 2006 17:00:23 -0700

I've got two equal arrays that contain an array of dictionaries containing two objects each (an NSDate and an NSString).

If I compare them with isEqualToArray:, they're marked as not equal. However, if I iterate the arrays and compare the dictionaries with isEqualToDictionary: none of them are considered to be unequal. I don't get it.... Why is isEqualToArray: returning NO (the last 0 after the output of each array)?

NSLog(@"Stored Adobe Files (%@) versus actual adobe files (%@), %d", storedFiles, newFiles, [newFiles isEqualToArray:storedFiles]);

Outputs:

2006-11-02 16:43:01.588 System Preferences[9273] Stored Adobe Files ((
{
"Date Last Modificated" = 2005-10-11 10:34:16 -0700;
Path = "/Volumes/Apostasy/rosyna/Library/Application Support/Adobe/TypeSpt/AdobeFnt05.lst";
},
{
"Date Last Modificated" = 2004-12-20 23:54:44 -0700;
Path = "/Volumes/Apostasy/rosyna/Library/Application Support/Adobe/TypeSpt/AdobeFnt06.lst";
},
{
"Date Last Modificated" = 2006-09-15 07:27:37 -0700;
Path = "/Volumes/Apostasy/rosyna/Library/Application Support/Adobe/TypeSpt/AdobeFnt07.lst";
},
{
"Date Last Modificated" = 2004-07-16 13:56:48 -0700;
Path = "/Library/Application Support/Adobe/TypeSpt/AdobeFnt.lst";
}
)) versus actual adobe files ((
{
"Date Last Modificated" = 2005-10-11 10:34:16 -0700;
Path = "/Volumes/Apostasy/rosyna/Library/Application Support/Adobe/TypeSpt/AdobeFnt05.lst";
},
{
"Date Last Modificated" = 2004-12-20 23:54:44 -0700;
Path = "/Volumes/Apostasy/rosyna/Library/Application Support/Adobe/TypeSpt/AdobeFnt06.lst";
},
{
"Date Last Modificated" = 2006-09-15 07:27:37 -0700;
Path = "/Volumes/Apostasy/rosyna/Library/Application Support/Adobe/TypeSpt/AdobeFnt07.lst";
},
{
"Date Last Modificated" = 2004-07-16 13:56:48 -0700;
Path = "/Library/Application Support/Adobe/TypeSpt/AdobeFnt.lst";
}
)), 0



On this iteration, mistmatch is never YES. They're always equal.


if (storedFiles and newFiles and [storedFiles count]==[newFiles count] and ![newFiles isEqualToArray:storedFiles])
{
int i=0;
BOOL mismatch=NO;
for (i=0;i<[newFiles count];i++)
{
NSDictionary* storedDict=[storedFiles objectAtIndex:i];
NSDictionary* newDict=[newFiles objectAtIndex:i];
if (![storedDict isEqualToDictionary:newDict])
{
NSLog(@"%@ does not equal %@", storedDict, newDict);
mismatch=YES;
break;
}
}
if (!mismatch)
equalArray=YES;
}
--



Sincerely, Rosyna Keller Technical Support/Carbon troll/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Problem overriding a factory class mehtod
  • Next by Date: Re: Problem overriding a factory class mehtod
  • Previous by thread: Re: Re: Problem overriding a factory class mehtod
  • Next by thread: Re: isEqualToArray: returning NO for equal arrays
  • Index(es):
    • Date
    • Thread