I have 2 Nsarray where objects of 2 arrays are same may be indexes of the object differs, but it should print both are equal irrespective of there indexes
NSArray *arr1 = [[NSArray alloc]initWithObjects:@"aa", @"bb", @"1", @"cc", nil];
NSArray *arr2 = [[NSArray alloc]initWithObjects:@"bb", @"cc", @"1", @"aa", nil];
if ([arr1 isEqualToArray:arr2])
{
NSLog(@"Equal");
}
else
{
NSLog(@"Not equal");
}
the above code is printing 'Not equal' but it should print 'Equal'. How can I do this?
Just like rmaddy said, those NSArrays are not equal. Try this: