I was using following code to find distance between 2 points:
CLLocation *location1 = [[CLLocation alloc] initWithLatitude:28.3636 longitude:-77.1212];
CLLocation *location2 = [[CLLocation alloc] initWithLatitude:42.353297 longitude:-71.578858];
float target = [location1 getDistanceFrom:location2];
But now getDistanceFrom is deprecated by Apple.
What should I try to perform same task?
How about -distanceFromLocation:
instead? It's even explicitly mentioned in the documentation on -getDistanceFrom:
as the method to use as a replacement.
You want to use 'distanceFromLocation:'. See the documentation for more: http://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html
精彩评论