从嵌套的NSDictionary读取值

问题描述 投票:0回答:2

我无法访问NSDictionary中的值,我想阅读“user5”键的值,我无法弄清楚正在发生什么或如何访问此值,我附上了由我创建断点时的调试器:[Here] [1]

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

ios swift xcode nested nsdictionary
2个回答
0
投票

你可以试试

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)
        }
   }
}

0
投票
let data = NSDictionary()
print((datat.value(forKey: "Key1") as! NSDictionary).value(forKey: "Key2") as! String)
© www.soinside.com 2019 - 2024. All rights reserved.