I am calculating total number of feet climbed when user walking. I am using below core-location delegate method.
I declared oldelevation,newelevation and Totalelevation as int.
First Time I am taking Current spot Elevation to oldelevation.
- (void)locationUpdate:(CLLocation *)location
{
newelevation =[location altitude]; // Present Elevation
if (newelevation > oldelevation) {
TotalElevation = TotalElevation + newelevation - oldelevation;
}
oldelevation=newelevation;// Storing current elevation in old elevation.
}
Finally At the end of walk I multiplied Totalelevation with 3.28084 to get total number of feet climbed.
I am comparing my results with Runtastic Application.
I walked 0.40 Miles, Where Runtastic is 16 feet and my app total number of feet climbed is 208 feet.
I referred the following links but those are not giving accurate results.
Calculating Cumulative elevation gain give me wierd results