【发布时间】:2016-10-14 13:26:54
【问题描述】:
我目前正在做一个带有谷歌地图自动完成功能的 ios swift 应用程序。在 swift 2.0 中,我确实喜欢这样来获取经度和纬度值:
let dic = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableLeaves) as! NSDictionary
let lat = dic["results"]?.valueForKey("geometry")?.valueForKey("location")?.valueForKey("lat")?.objectAtIndex(0) as! Double
let lon = dic["results"]?.valueForKey("geometry")?.valueForKey("location")?.valueForKey("lng")?.objectAtIndex(0) as! Double
但是使用 swift 3,它不再工作了。我能做什么?
【问题讨论】:
标签: json dictionary swift3