CLLocationManager区域监视有时不在后台工作

时间:2014-03-31 06:00:02

标签: ios iphone sdk cllocationmanager geofencing

我在CLLocationManager中使用地理围栏。这是做什么的 应用于活动状态调用[self.locationManager startUpdatingLocation];并获取当前位置,然后获得最近的位置设置(最大20),然后设置为区域监视。在设置区域监视之前,我使用此方法停止所有受监视区域

for (CLRegion *monitored in [self.locationManager monitoredRegions])
        [self.locationManager stopMonitoringForRegion:monitored];

然后将位置设置为locationmanger。当应用程序转到后台时。

 [self.locationManager stopUpdateLocation];
      [self.locationManager startMonitoringSignificantLocationChanges];

当在abckground中应用显着的位置变化时,它获取当前位置并发送位置,获取最近的位置集并将其设置为区域监视。在此处,我还在设置新位置之前停止先前受监视的区域。 问题是有时我必须多次设置相同的位置(相同的lat lon),因为用户可以在后台应用时多次传递相同的位置。在这种情况下有时候

- (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region

这种方法没有调用。有些时候我得到了我之前设置的区域更新。但是在我设置新区域之前我停止所有区域。

任何人都有想法

0 个答案:

没有答案
相关问题