问题
When I wait until Xcode 6.1.1 hits a breakpoint after this line
let metrics = ["leading" : 15.0, "size" : 44.0]
and then type po metrics the debugger reports (after several seconds delay) {}, which seems wrong. po metrics.count reports 2, which is right.
Is this a feature or a bug?
UPDATE The problem appears when debugging on a physical device (iPhone 5), e.g. not on a simulator (e.g. iPhone 6 Plus).
回答1:
Did you try doing this way?
let metrics:NSDictionary? = ["leading" : 15.0, "size" : 44.0]
println(metrics!)
来源:https://stackoverflow.com/questions/28124159/xcode-debugger-reporting-swift-dictionaries-as-empty-po-reports