[英]HTML string is not Working in MAC Catalyst
HTML 屬性字符串在 Mac Catalyst 中不起作用,但在 iPhone 和 iPad 上運行良好。 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()
}
}
Mac Catalyst 中的錯誤是
連接到名為 com.apple.textkit.nsattributedstringagent 的 pid 17352 上的服務:在對消息“renderHTML:options:withReply:”的回復進行解碼時捕獲異常,丟棄傳入消息並調用失敗塊。
忽略的異常:解碼參數 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
)}'.
我認為這是 Mac Catalyst 的錯誤。 生成 NSColor 的 NSAtributed 字符串在 Catalyst 中不受支持
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.