从嵌套的 NSDictionary 读取值

Reading value from nested NSDictionary

我在访问 NSDictionary 中的值时遇到问题,我想读取 "user5" 键的值,但我不知道发生了什么或如何访问这个值,我附上了创建断点时调试器生成的屏幕截图: [这里][1]

感谢您提供的任何帮助:)

你可以试试

if let va = values["LMN9xAUOcgsw4c6GJb4"] as? [String:Any] {
   if let users = va["users"] as? [String:Any] {
        if let user = users["user5"] as? String {
           print(user)
        }
   }
}
let data = NSDictionary()
print((datat.value(forKey: "Key1") as! NSDictionary).value(forKey: "Key2") as! String)