gpt4 book ai didi

swift - 类型 'NSAttributedString' 的值没有成员 'addAttributes'

转载 作者:行者123 更新时间:2023-12-04 11:04:35 26 4
gpt4 key购买 nike

我查了 documentation方法就在那里。

当我查看 .h 文件时,我确实看到了该功能。我尝试清理和重建,但在迁移到 Swift 4 后仍然出现此错误。

Value of type 'NSAttributedString' has no member 'addAttributes'



在以下方面:
var options:[NSAttributedString.DocumentReadingOptionKey : Any] = [NSAttributedString.DocumentReadingOptionKey.documentType : NSAttributedString.DocumentType.html]
var attributedString = try NSAttributedString(data: data, options: options, documentAttributes: nil)
let range = (attributedString.string as NSString).range(of: attributedString.string)
attributedString.addAttributes(baseAttributes, range: range) // ERROR!

最佳答案

对于谷歌带来的其他人,我失踪了 import UIKit

关于swift - 类型 'NSAttributedString' 的值没有成员 'addAttributes',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46835185/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com