【发布时间】:2016-08-12 03:40:30
【问题描述】:
我计算了如下 2 个位置距离,结果始终为 0 米。 有人可以帮忙吗?
double distance = [self.currentLocation distanceFromLocation:location1];
NSLog(@"Distance i meters: %.8f", distance);
if(distance <30)
{
NSLog(@"Yeah, this place is inside my circle");
}
else
{
NSLog(@"Oops!! its too far");
}
谢谢
【问题讨论】:
-
首先验证
self.currentLocation和location1都不是零。distance将是0,如果其中一个是nil。 -
你看到我的回答@user831098 对你有帮助吗?
标签: ios ios9 cllocationmanager distance