【发布时间】:2018-03-22 10:34:23
【问题描述】:
我正在尝试从 cllocation 中获取纬度和经度值。它即将到来的完整位置数据。因为我只需要纬度和经度数据来发送我的后端。我必须向服务器发送多个经纬度数据。
即使我尝试使用 CLLocationCoordinate2D,但是,它在发送到服务器时在数据中获取 CLLocationCoordinate。
我想同时接受纬度和经度的单个数组,而不是两个 数组。
谁能建议我,如何只取纬度和经度值 快速追加到数组?
这是我的代码
var myLocations: [CLLocation] = []
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
myLocations.append(locations[0] as CLLocation)
}
output is
<+10.92088132,+77.56955708> +/- 1414.00m (speed -1.00 mps / course -1.00) @ 22/03/18, 1:17:30 PM India Standard Time
[<+10.92088132,+77.56955708> +/- 1414.00m (speed -1.00 mps / course -1.00) @ 22/03/18, 1:17:30 PM India Standard Time]
【问题讨论】:
标签: ios swift latitude-longitude cllocation location-services