gpt4 book ai didi

ios - 如何从 Parse 数组中获取 closeGeoPoint 位置?

转载 作者:行者123 更新时间:2023-11-30 13:54:15 26 4
gpt4 key购买 nike

我正在尝试使用whereKey,nearGeoPoint。唯一的问题是我的位置位于一系列位置中。我如何从该数组中获取单个位置?下面是我的代码...

    func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
postQuery.whereKey("locations", nearGeoPoint: PFGeoPoint(latitude: locations[0].coordinate.latitude, longitude: locations[0].coordinate.longitude), withinMiles: 30)
}

最佳答案

来自 CLLocationManagerDelegate 的文档:

This array always contains at least one object representing the current location. If updates were deferred or if multiple locations arrived before they could be delivered, the array may contain additional entries. The objects in the array are organized in the order in which they occurred. Therefore, the most recent location update is at the end of the array.

如果您想将最新位置发送到 Parse,您应该使用 locations.last

关于ios - 如何从 Parse 数组中获取 closeGeoPoint 位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33851513/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com