无法将类型'[NSObject:AnyObject]'的值赋给类型'[String:AnyObject]!'的值

时间:2015-10-28 04:22:38

标签: swift firebase

我从FireBase ios-swift-chat-example中收到此错误。

where the issue lies

2 个答案:

答案 0 :(得分:2)

在将字典分配给常量变量时​​,您不需要输入强制转换,因为您已经创建了[String : AnyObject]类型的字典,这需要分配给UITextView.linkTextAttributes

let attributes = [NSForegroundColorAttributeName:cell.textView!.tintColor,NSUnderlineStyleAttributeName:1]
cell.textView!.textView.linkTextAttributes = attributes

答案 1 :(得分:0)

检查您是否正在处理字符串或字典。在我的情况下我把字典作为字符串处理。

相关问题