这里有什么问题?我试图获得总行驶距离,但是当我开始开车回到起点时,我的价值下降了?需要修复什么。谢谢你。
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
if (startLocation == nil)
self.startLocation = newLocation; //if this is the first update colocation called startlocation = new location
CLLocationDistance distanceBetween = [newLocation
distanceFromLocation:startLocation]; //here is my problem I think
NSString *tripString = [[NSString alloc] //convert to string
initWithFormat:@"%f",
distanceBetween];
distance.text = tripString; //update my distance label called distance
}