-2
我目前正在做一个谷歌地图自动完成功能的ios swift应用程序。在SWIFT 2.0我不喜欢这样获得的经度和纬度值:Swift 3 downcasting JSON Dictionary
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,它不工作了。我能做什么?
非常感谢它的工作正常! –