这是我创建geofence的代码:
Geofence *geofence = [[Geofence alloc] init];
[geofence setRadius:100.0];
[geofence setIdentifier: @"Fence1"];
[geofence setLocation:currentlocation];
CLRegion *region1 = [[CLCircularRegion alloc] initWithCenter:[geofence.location coordinate]
radius:geofence.radius
identifier:geofence.identifier];
region1.notifyOnEntry=YES;
region1.notifyOnExit=YES;
[self.locationManager startMonitoringForRegion:region1];我可以说,上面的代码可以工作,这意味着已经创建了geofence。但我遇到了一个问题。
我有一个.gpx文件(我将在其中模拟我当前的位置),它们与区域/地理栅栏中心的距离如下:55米、90米、150米、200米、300米、500米、1公里、5公里和10公里。
我的问题是,我的地理栅栏半径似乎不是真正的100米,因为当我使用gpx文件模拟时,这些文件离地理栅栏中心的距离是55m,90m,150,200m,300m,500m,1 1km。LocationManager -didEnterRegion和-didExitRegion的委托方法正在响应我在我的地理范围内,它的半径只有“100米”。
只有离我的Geofence中心的距离为5‘m和10’m的gpx文件才会从上述委托方法中响应我在geofence之外。
伙计们,你能帮我解决这个问题吗?

发布于 2014-05-06 08:02:26
我认为问题可能是你使用相同的变量来初始化你的区域,就中心坐标而言,你正在使用那些你用来初始化你的geofence的变量。因此,一个人总是认为它在另一个人之中。
https://stackoverflow.com/questions/22225037
复制相似问题