NSLinkAttributeName conflicts with NSUnderlineStyleNone

Originator:xx2004xiamen
Number:rdar://28751512 Date Originated:13-Oct-2016
Status:Open Resolved:
Product:macOS SDK Product Version:10.12
Classification: Reproducible:YES
 
Give a NSAttributedString both NSLinkAttributeName:[NSURL someURL] and NSUnderlineStyleAttributeName:@(NSUnderlineStyleNone) ,
You will find the text still comes with NSUnderlineStyleSingle style, the NSUnderlineStyleNone is ignored.

Steps to Reproduce:
1. Codes like below:

//Create attributes including these two
NSDictionary *attributes = @{NSUnderlineStyleAttributeName:@(NSUnderlineStyleNone),NSLinkAttributeName:@"123"};

//Create attributedString with the attributes
NSMutableAttributedString *attributedString =  [[NSMutableAttributedString alloc]initWithString:userName attributes:attributes];

//Assign attributedString to a NSTextField
[someTextField setAttributedStringValue: attributedString];

2. Build an run

Expected Results:
The NSTextField shows the string without any underline.

Actual Results:
The NSTextField shows the string with an underline.

Version:
Xcode 8.0 (8A218a), macOS 10.12 (16A323)

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!