Ketan Shinde Ketan Shinde - 1 year ago 87
iOS Question

Region monitoring and background

I have little doubt and wants to know is it necessary to reassign all regions again to location manager, if it receive the post notification for


here is some code snippet.

- (IBAction)startAction:(id)sender
for (Geofencing *gObjects in plotingArrays) {
CLCircularRegion *getRegion = [self dictToRegion:gObjects];
[monitorLocationManager startMonitoringForRegion:getRegion];

So when app enters in back ground i did like this:

# pragma mark - BackGround Notification
monitorLocationManager = [selectRouteController sharedLocationMonitor];
monitorLocationManager.delegate = self;
for (Geofencing *gObjects in plotingArrays) {
CLCircularRegion *getRegion = [self dictToRegion:gObjects];
[monitorLocationManager startMonitoringForRegion:getRegion];

So is it necessary to reassign the regions again to location manger when app enter in background? OR it will automatically monitor once the region is assigned to location manager on


+ (CLLocationManager *)sharedLocationMonitor {
static CLLocationManager *locationMonitor;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{

locationMonitor = [[CLLocationManager alloc] init];
locationMonitor.desiredAccuracy =

locationMonitor.activityType =
[locationMonitor requestAlwaysAuthorization];

locationMonitor.allowsBackgroundLocationUpdates = YES;

locationMonitor.pausesLocationUpdatesAutomatically = NO;
return locationMonitor;


App plist configuration

Answer Source

No, You don't need to restart monitoring for region when your app enters in background. It will automatically monitor region if you have configured it.

You need to configure following in info.plist:

<string>I want to get your location Information in background</string>


And you also need to set AllowsBackgroundLocationUpdates to yes.

 [monitorLocationManager setAllowsBackgroundLocationUpdates:YES];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download