XCode 7打印键和Dictionary的值 [英] XCode 7 print keys and values of Dictionary
问题描述
xcode 7中的打印说明给出了类似于以下内容的内存地址.尝试了所有选项,但获得了这样的输出.请让我知道如何打印字典的确切值.
Print description in xcode 7 is giving memory addresses similar to below. Tried all the options, but getting output like this. Please let me know how to print the exact value of a dictionary.
▿ 3 elements
▿ [0] : 2 elements
- .0 : Output
▿ .1 : 3 elements
▿ [0] : 2 elements
- .0 : type
- .1 : Output2 { ... }
▿ [1] : 2 elements
- .0 : version
- .1 : 1.0
▿ [2] : 2 elements
- .0 : content
▿ .1 : 2 elements
不确定苹果为什么100%集中在控制台窗口上.从XCode 5更改为6、6更改为6.2、6.2更改为6.4,现在从6.4更改为7.控制台)
Not sure why Apple is 100% concentrating on console window.. there is change from XCode 5 to 6, 6 to 6.2, 6.2 to 6.4 and now 6.4 to 7.. I think Apple should focus on improving the quality instead of console)
推荐答案
我创建了此测试词典:
let dict:Dictionary = ["key1": "value1", "key2": 42, "keyForColor": UIColor.redColor()]
然后我使用po dict
并获得您描述的结果:
Then I used po dict
and get the result you described:
po dict
▿ 3 elements
▿ [0] : 2 elements
- .0 : "key1"
- .1 : value1
▿ [1] : 2 elements
- .0 : "keyForColor"
▿ [2] : 2 elements
- .0 : "key2"
使用po dict.description
时,您会得到以下提示:
When you use po dict.description
, you get this:
po dict.description
"[\"key1\": value1, \"keyForColor\": UIDeviceRGBColorSpace 1 0 0 1, \"key2\": 42]"
这篇关于XCode 7打印键和Dictionary的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!