views:

43

answers:

1

Hello,

I'm trying to calculate the distance between two places user Core Location. I've found a few posts that state to use

-(CLLocationDistance)distanceFromLocation:(const CLLocation *)location

Found some other test code in the thread below:

http://stackoverflow.com/questions/1171138/cllocationdistance-nan

I'm not sure how to put it all together, to get the result I want ?

Anyone any thoughts ?

Regards, Stephen

+1  A: 

If you have a location named myLocation and want to find the distance from another location, say, restaurantLocation, then it seems you would do something like

CLLocationDistance distance = [myLocation distanceFromLocation:restaurantLocation]

This will give you the distance, in meters, between the two.

dc
Dc, thanks for the response. In the example above what exactly does myLocation contain. Is it the longitude and latitude of my current location. Could you please explain.
Stephen
Dc, please ignore the comment above, I got around this problem.
Stephen