寻找2点之间距离的新方法

Ran*_*wan 0 iphone location distance

我使用以下代码来查找2点之间的距离:

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];
Run Code Online (Sandbox Code Playgroud)

但现在Apple已弃用getDistanceFrom.

我应该尝试执行相同的任务?

Lil*_*ard 6

-distanceFromLocation:相反怎么样?它甚至在文档中明确提到-getDistanceFrom:作为替代方法.