Find nearest by lat/long with Core Data

前端 未结 3 1329
鱼传尺愫
鱼传尺愫 2021-02-10 02:23

I have an iPhone app with a Core Data database containing a list of locations, each with lat/long coordinates. How can I search for say the nearest 10 to my current location?

3条回答
  •  旧时难觅i
    2021-02-10 02:43

    There is also a CoreLocation function which solves that particular issue :

    - (CLLocationDistance)getDistanceFrom:(const CLLocation *)location
    

提交回复
热议问题