if (userFollowingArray[indexPath.row]["watcher_following"] as! Bool) == false {
let dict : NSMutableDictionary = userFollowingArray[indexPath.row] as! NSMutableDictionary
print(dict)
dict["watcher_following"] = 1
self.userFollowingArray[indexPath.row] = dict as! Dictionary<String, Any>
}
更新词典的按键我想更新与true/false
watcher_following
关键,但它抛出一个异常。如何斯威夫特3
[_TtGCs26_SwiftDeferredNSDictionarySSP__ _swift_setObject:forKeyedSubscript:]:无法识别的选择发送到实例
将'let dict'改为'var dict',然后尝试 –
它是在tapped action中吗? –
为什么NSMutableDictionary而不是var中的Swift字典?为什么强制铸造一切?这是斯威夫特,但这看起来更像Objective-C比斯威夫特3 ... – Moritz