IOS: Why is the stopped location icon still showing after stopping monitoring for regions?

I am testing the 3rd generation iPad on iOS 7.1, because at the moment I do not have another iOS device.

When I first launch my application, it starts monitoring for several regions. The status bar and the location services settings page show the highlighted location icon (my application is the only one in the list with a sketched icon). When I kill the application, the icon is still displayed in both places, since I do not stop control over the regions. Until then, everything is in order.

My problem is that I launch my application a second time, I stop monitoring for all controlled regions, but the location description icon does not appear in the status bar and the location services settings page ...

Here is my code called on first run:

- (void) getLocationManagerInstance {
    if (!self.locationManager) {
        self.locationManager = [CLLocationManager new];
    }
    self.locationManager.delegate = self;
}

- (void) startLocationGathering {
    if(self.shouldUpdateGPSLocations) {
        [self.locationManager startMonitoringSignificantLocationChanges];
    }
}

- (void) startMonitoringBeaconRegions {
    if(self.rootRegion) {
        [self.locationManager startMonitoringForRegion:self.rootRegion];
    }
    if (self.beaconRegions && self.beaconRegions.count < 20) {
        [self.beaconRegions enumerateObjectsUsingBlock:^(CLBeaconRegion* region, NSUInteger idx, BOOL *stop) {
            [self.locationManager startMonitoringForRegion:region];
        }];
    }
}

- (void) startMonitoringCircularRegions {
    if (self.gpsRegions && self.gpsRegions.count) {
        [self.gpsRegions enumerateObjectsUsingBlock:^(CLCircularRegion* region, NSUInteger idx, BOOL *stop) {
            [self.locationManager startMonitoringForRegion:region];
        }];
    }
}

And my code is called in the second run:

- (void) getLocationManagerInstance {
    if (!self.locationManager) {
        self.locationManager = [CLLocationManager new];
    }
    self.locationManager.delegate = self;
}
- (void) locationManagerCleanup {
    [AWRUtils dlog:@"locationManagerCleanup"];
    NSArray* monitoredRegions = [self.locationManager monitoredRegions].allObjects;
    for (CLRegion* r in monitoredRegions) {
        [self.locationManager stopMonitoringForRegion:r];
    }
    NSArray* rangedRegions = [self.locationManager rangedRegions].allObjects;
    for (CLBeaconRegion* r in rangedRegions) {
        [self.locationManager stopRangingBeaconsInRegion:r];
    }
    [self.locationManager stopUpdatingLocation];
    [self.locationManager stopMonitoringSignificantLocationChanges];
}

If I uninstall my application, the location icon disappears. But why does the icon not disappear when I cease to control controlled regions?


EDIT: after more testing, I found that the CLLocationManager instance that I have in the second run does not have controlled areas ( [self.locationManager monitoredRegions]returns nil) ...


EDIT 2: , , , , . ? -...

+4

All Articles