isEqual returns NO for identical UIFonts constructed differently
| Originator: | pohilets | ||
| Number: | rdar://28406766 | Date Originated: | 21/09/2016 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | iOS 10.0.1 (14A403) |
| Classification: | Reproducible: | Always |
Summary: Behavior of methods -[UIFont isEqual:] and -[UIFontDescriptor isEqual:] have changed in iOS 10. New behavior is counter intuitive, inconvenient for practical usage and not reflected in documentation. Steps to Reproduce: UIFont* f1 = [UIFont fontWithName:@"Bradley Hand" size:42]; UIFontDescriptor* fd1 = f1.fontDescriptor; UIFont* f2 = [UIFont fontWithName:@"Bradley Hand" size:13]; UIFontDescriptor* fd2 = f2.fontDescriptor; UIFontDescriptor* fd3 = [fd2 fontDescriptorWithSize:42]; UIFont* f3 = [UIFont fontWithDescriptor:fd3 size:0]; BOOL fdOK = [fd1 isEqual:fd3]; BOOL fOK = [f1 isEqual:f3]; NSCAssert(fdOK && fOK, @"Fonts should be equal"); Expected Results: fdOK should be YES fOK should be YES Assertion should pass Actual Results: fdOK is NO fOK is NO Assertion fails Version: iOS 10.0.1 (14A403) Notes: On iOS 9.3.5 (13G36) and iOS 8.4.1 (12H321) behavior matches with expected result Configuration: iPhone 7, iPhone 7 Simulator
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!