I know in Objective-C ==
is very different from isEqual:
. But I am curious about why the following code produces consistently different results on 32bit vs 64bit iOS devices.
NSIndexPath* a = [NSIndexPath indexPathForItem:0 inSection:0];
NSIndexPath* b = [NSIndexPath indexPathForItem:0 inSection:0];
NSLog(@"%@", a == b ? @"YES" : @"NO");
NSLog(@"%@", [a isEqual:b] ? @"YES" : @"NO");
On 32 bit device, e.g. iPhone 5, ==
always fails (expected).
2016-12-07 09:55:18.019 NSIndexPathTestObjc[18667:1958831] NO
2016-12-07 09:55:18.020 NSIndexPathTestObjc[18667:1958831] YES
On 64 bit device, e.g. iPhone 6s, ==
succeeds (unexpected).
2016-12-07 09:56:05.503 NSIndexPathTestObjc[18780:1960472] YES
2016-12-07 09:56:05.505 NSIndexPathTestObjc[18780:1960472] YES