Core Data and Core Location

后端 未结 3 1239
野趣味
野趣味 2020-11-30 21:04

I have a Core Data database with latitude and longitude properties. Is there a way to use Core Location\'s getDistanceFrom: method to find the five nearest loca

3条回答
  •  旧巷少年郎
    2020-11-30 21:33

    You can't use CoreData to find the nearest object, but might want to narrow down the query by using a bounding box. To find the nearest object, you might prefer to use simply the difference in lat/long which is considerably faster than calculating the actual distances.

    I had a similar question:

    CoreData: Find minimum of calculated property

提交回复
热议问题