Core Data and Core Location

后端 未结 3 1234
野趣味
野趣味 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:17

    The following example is almost what you are looking for. It uses a SQLite function to calculate the distance in the ORDER BY clause (Haversine formula). Problem is that this example does not use Core-Data, but the SQLite API directly.

    http://www.thismuchiknow.co.uk/?p=71

提交回复
热议问题