在 Xcode 调试器中查看 NSDictionary 变量的内容的方法是:
po dictionaryObject
var employees = ["Alice": "Software Developer", "Bob": "Business Analyst"]您可以在控制台中键入以下命令:po employees输出:{
Alice: "Software Developer",
Bob: "Business Analyst"
}var dictionaries = [["Name": "Alice", "Age": 27], ["Name": "Bob", "Age": 32]]您可以在控制台中键入以下命令:po dictionaries输出:["{\"Name\":\"Alice\",\"Age\":27}","{\"Name\":\"Bob\",\"Age\":32}"]var nestedDictionary = ["Dictionary": ["Key1": "Value1", "Key2": "Value2"], ["Array": [1, 2, 3]] ]您可以在控制台中键入以下命令:po flattened(nestedDictionary)输出将显示如下内容:{"Dictionary":["Key1":"Value1","Key2":"Value2"],"Array":[1,2,3]}flattened
操作符将其展开,以便查看所有的键值对:领取专属 10元无门槛券
手把手带您无忧上云