An UIColor instance A isn't equal to the instance B obtained by archiving and unarchiving the instance A.
| Originator: | jose.joao | ||
| Number: | rdar://19015285 | Date Originated: | 18-Nov-2014 01:41 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | iOS 8.1.1 |
| Classification: | Reproducible: | YES |
Summary:
An UIColor instance A isn't equal to the instance B obtained by archiving and unarchiving the instance A.
It happens only on devices with 64bit architecture.
Follows the code snippet :
UIColor *color = [UIColor colorWithRed:1. green:0.4 blue:0. alpha:1.];
NSData *colorData = [NSKeyedArchiver archivedDataWithRootObject:color];
UIColor *color2 = [NSKeyedUnarchiver unarchiveObjectWithData:colorData];
BOOL isDevice64Bit = sizeof(void*) == 8;
NSLog(@"is64Bit: %i - isEqual: %i", isDevice64Bit, [color isEqual:color2]);
The isEqual above should always return true, but it does not for devices with 64bit architecture.
Steps to Reproduce:
Create a iOS empty project and paste the following code inside of the "application:didFinishLaunchingWithOptions:" method and run it using iPhone 5s or higher:
UIColor *color = [UIColor colorWithRed:1. green:0.4 blue:0. alpha:1.];
NSData *colorData = [NSKeyedArchiver archivedDataWithRootObject:color];
UIColor *color2 = [NSKeyedUnarchiver unarchiveObjectWithData:colorData];
BOOL isDevice64Bit = sizeof(void*) == 8;
NSLog(@"is64Bit: %i - isEqual: %i", isDevice64Bit, [color isEqual:color2]);
Expected Results:
It should always log "is64Bit: 0 - isEqual: 1" or "is64Bit: 1 - isEqual: 1"
Actual Results:
It logs "is64Bit: 0 - isEqual: 1" or "is64Bit: 1 - isEqual: 0"
Version:
iOS 8.1.1
Notes:
Configuration:
64bit devices (iPhone 5s, 6, 6plus, iPad air, mini retina)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!