How to store location data for tracking using core data?
I want to track traveling path (by car) an开发者_Python百科d plot to MKMapView later, but I don't sure what is the best way to do this. I'm thinking oด coordinate entity with latitude and longitude property and timestamp for retrieve it in order. Will this cause any issues ? How most tracker app implement this kind of behavior ?
Storing latitude and longitude (as CLLocationDegrees (AKA doubles)) is a perfectly adequate way of modeling your data. You may wish to add horizontalAccuracy as well, just so you can maintain some sort of fuzziness criteria.
In your custom entity code you'll also probably want to have a transformers:
-(CLLocation *)location;
-(void)setLocation:(CLLocation *)location;
to emit something that the MKMapView can use later.
精彩评论