The wikipedia article on Geographical distance has some formulae to calculate geodesic distances.
Here is a piece of code I'm currently using that gave me acceptable results:
const float EarthRadius = 6378137.0f;
float SquaredGeodesicDistance(CLLocationCoordinate2D a, CLLocationCoordinate2D b)
{
float dtheta = (a.latitude - b.latitude) * (M_PI / 180.0);
float dlambda = (a.longitude - b.longitude) * (M_PI / 180.0);
float mean_t = (a.latitude + b.latitude) * (M_PI / 180.0) / 2.0;
float cos_meant = cosf(mean_t);
return (EarthRadius * EarthRadius) * (dtheta * dtheta + cos_meant * cos_meant * dlambda * dlambda);
}
float GeodesicDistance(CLLocationCoordinate2D a, CLLocationCoordinate2D b)
{
return sqrtf(SquaredGeodesicDistance(a, b));
}