I have this statement that im trying to figure out how to use in core data.
SELECT
(3963.0 * acos(sin(".$StartLat."/57.2958) * sin(latitude/57.2958) + cos(".$StartLat."/57.2958) * cos(latitude/57.2958) * cos(longitude/57.2958 - ".$StartLon."/57.2958))) as distance
FROM locations
ORDER BY distance
LIMIT 0, 10
Im guessing this is the part i need to modify:
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"Title" ascending:NO];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
Thanks in advance.