HTML string is not Working in MAC Catalyst

Viewed 111

HTML attributed string is not working in Mac Catalyst but it is working fine on iPhone and iPad. HTML String code are the below.

var htmlToAttributedString: NSAttributedString? {
        guard let data = data(using: .utf8) else { return NSAttributedString() }
        do {
            return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue], documentAttributes: nil)
        } catch {
            return NSAttributedString()
        }
    }

And the error in Mac Catalyst is

connection to service on pid 17352 named com.apple.textkit.nsattributedstringagent: Exception caught during decoding of reply to message 'renderHTML:options:withReply:', dropping incoming message and calling failure block.

Ignored Exception: Exception while decoding argument 1 (#2 of invocation):

<NSInvocation: 0x600001802d80>
return value: {v} void
target: {@?} 0x0 (block)
argument 1: {@} 0x7fff85206780
argument 2: {@} 0x0
argument 3: {@} 0x0

Exception: value for key 'NS.objects' was of unexpected class 'NSColor'. Allowed classes are '{(
    NSNull,
    UIColor,
    NSArray
)}'.

1 Answers

I think its a bug of Mac Catalyst. NSAtrributed String generating NSColor which is not supported in Catalyst

Related