【发布时间】:2019-08-06 05:43:08
【问题描述】:
我目前正在做一个 IOS 项目,我必须计算两个位置之间的距离。我没有使用谷歌,但我想使用谷歌 api 来获得准确的距离,我在这里分享我的代码
let myLocation = CLLocation(latitude: CLLocationDegrees(latittude[indexPath.row])!, longitude: CLLocationDegrees(longittude[indexPath.row])!)
let lat = UserDefaults.standard.string(forKey: "lat") ?? ""
let long = UserDefaults.standard.string(forKey: "long") ?? ""
let myBuddysLocation = CLLocation(latitude: CLLocationDegrees(lat)!, longitude: CLLocationDegrees(long)!)
【问题讨论】:
-
我想用两个位置的纬度和经度计算距离
-
@DiegoCarrera 为什么会这样?
标签: ios swift google-maps geolocation geocoding