I have an application that contains some Locations in Core Data, and I want to show them to the user in order of proximity to the user's location. I am using an NSFetchedResultsController to serve the locations to the Table View. I thought about creating a virtual accessor method that returns the location's distance from the user, that would be calculated using a "global" CoreLocationManager, but it crashes with reason:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath distanceFromCurrentLocation not found in entity < NSSQLEntity Location id=4>'
I also give the user the option to sort alphabetically, so I would prefer it if I kept the NSFetchedResultsController, if possible.
How should I do it?
Thanks!