当我在iOS上使用地理区域监控时,我的入境和出境代表永远不会被解雇,除非我将locationmanager授权状态设置为始终。
即使应用程序位于前台,事件也不会发生。
一旦我切换到Always,嘿,一切正常。
我已将我的位置管理器设置如下
self.sharedLocationManager = [sbLocationManagerHelper sharedLocationManagerHelper];
self.sharedLocationManager.locationManager = [[CLLocationManager alloc]init];
self.sharedLocationManager.locationManager.delegate = self;
self.sharedLocationManager.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.sharedLocationManager.locationManager.distanceFilter = 10;
self.sharedLocationManager.locationManager.activityType = CLActivityTypeOther;
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined
|| [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse)
{
[self.sharedLocationManager.locationManager requestAlwaysAuthorization];
} [self.sharedLocationManager.locationManager stopMonitoringSignificantLocationChanges];
当应用程序背景但区域监控仍然发生时,是否有办法使位置图标消失,甚至显示区域监控图标?
我正在使用SDK 9并定位ios 8 +
答案 0 :(得分:0)
我发现您必须使用requestAlwaysAuthorization来运行GeoFencing。
但是,当应用程序在后台运行或未运行时,您应该看到地理栅栏图标(概述的位置服务图标),而不是完整的紫色位置服务图标。
您是否在代码中调用了startUpdatingLocation或startUpdatingHeading?如果是这样,那么您将看到完整的位置服务图标,因为您的应用程序正在监视用户位置。如果您不需要他们的特定位置,请确保调用stopUpdatingLocation或stopUpdatingHeading。