【发布时间】:2016-09-13 09:32:16
【问题描述】:
我在转换为 swift 2.3 后出现此错误。
guard let json = try NSJSONSerialization.JSONObjectWithData(data!, options: []) as? NSDictionary else {
throw JSONError.ConversionFailed
}
guard
let loadedWeather = json["weather"]![0]["description"] as? String,
let loadedTemperatur = json["main"]!["temp"] as? Float,
let loadedWindSpeed = json["wind"]!["speed"] as? Float
else {
print("Weather JSON-Parsing failed")
return
}
Ambiguous use of subscript 错误来自声明“loadedWeather、loadedTemperatur 和 loadedWindSpeed”。
已经尝试将 NSDictionary 更改为 Dictionary 和其他东西,帮助了代码中的另一个位置,但是在这里....
谢谢大家
【问题讨论】:
标签: ios json swift dictionary