gpt4 book ai didi

ios - 无法使用类型为 '[NSAttributedStringKey : Any]' 的索引下标类型为 'String' 的值

转载 作者:搜寻专家 更新时间:2023-11-01 07:05:31 24 4
gpt4 key购买 nike

<分区>

我正在用 Swift 4.0 更新我的源代码我面临以下与属性文本相关的问题

以下代码在 swift 3.2 中运行良好。

entemessageText.highlightTapAction = { (containerView: UIView, text: NSAttributedString, range: NSRange, rect: CGRect) -> () in
let attributes = text.attributes(at: range.location, effectiveRange: nil)
if let attrs = attributes["YYTextHighlight"] as? YYTextHighlight {
if let url = attrs.userInfo!["url"] as? String {
self.openUrl(URL(string: url)!)
}
}
}

“无法使用类型为‘String’的索引下标类型为‘[NSAttributedStringKey:Any]’的值”enter image description here

我用相同的关键字搜索解决方案,但没有得到任何结果。

任何帮助或建议都会有所帮助。

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