Getting distance between two locations

I am using distancefrom method as well as MKDirectionRequest to get multiple routes and then getting distance from the first route. But the distance does not exactly match if locations are compared with Apple Maps.
Is there any other way to get accurate distances?
You should clarify what distance measurement you actually need first. Distances returned as driving directions can be very different than the direct distance between two points over the Earth's surface using CLLocation's distanceFromLocation: API, such as in mountainous regions. Further, if driving distance is truly what you need, the exact distance can vary based on routing changes due to traffic patterns or road closures.
I need the driving distance from a moving vehicle. When compared with the Apple Maps, the distance varies and I need an accurate distance similiar to what Apple Maps shows.
Is the problem that the distance isn't accurate for the provided directions, or that the distance is just different? The exact routing can change the distance. This is why I suggest you really clarify your goal -- why do you need an exact distance to be the same as Apple Maps? What are you trying to achieve? Are you directly providing the exact route to your users? Or are you trying to give your users a reasonable approximation of the distance when using a car without needing the exact turn-by-turn accuracy?

If you're looking at providing direction, compare the route you received with the route in Apple Maps -- the routes may not be identical for the reasons I stated. If what you need is really just an approximate distance, the distance data returned by calculateETAWithCompletionHandler is a better choice, because it will give you approximate travel time and distance without route-specific accuracy.
My goal is clear - My app has a map which shows the route and the travelled distance.
I consider the start and end points and calculate the distance using MKDirections API.
However, this distance somewhat varies with actual distance by 0.5 miles or so.
I need an accurate distance since it will be further used in my app for various purposes.

Have you compared that the routes from the routing API and what you see in Apple Maps are exactly the same at every turn? A half mile difference sounds like a slightly different route. Can you share an example?

You haven't clarified why you need an exact routing match between the MapKit API and Apple Maps -- what problem does this solve in your app? As I've outlined, there are a lot of reasons routing will vary, so you should not expect Apple Maps and the MapKit API to always match, nor should you expect that calls to the MapKit API will always return the exact same route either.
Getting distance between two locations
 
 
Q