简体   繁体   English

HTML 字符串在 MAC Catalyst 中不起作用

[英]HTML string is not Working in MAC Catalyst

HTML attributed string is not working in Mac Catalyst but it is working fine on iPhone and iPad. HTML 属性字符串在 Mac Catalyst 中不起作用,但在 iPhone 和 iPad 上运行良好。 HTML String code are the below. HTML 字符串代码如下。

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 Mac Catalyst 中的错误是

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.连接到名为 com.apple.textkit.nsattributedstringagent 的 pid 17352 上的服务:在对消息“renderHTML:options:withReply:”的回复进行解码时捕获异常,丢弃传入消息并调用失败块。

Ignored Exception: Exception while decoding argument 1 (#2 of invocation):忽略的异常:解码参数 1 时出现异常(调用的#2):

<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
)}'.

I think its a bug of Mac Catalyst.我认为这是 Mac Catalyst 的错误。 NSAtrributed String generating NSColor which is not supported in Catalyst生成 NSColor 的 NSAtributed 字符串在 Catalyst 中不受支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM