iOS Region Monitoring in Background Mode

后端 未结 3 1462
感情败类
感情败类 2021-02-14 01:09

I am using Region Monitoring in my app and I faced a question that I couldn\'t find any answer to it. How does region monitoring work in background mode?

According to Lo

3条回答
  •  佛祖请我去吃肉
    2021-02-14 01:57

    Region monitoring Relaunches your application when you enter the monitored region if you are in background .

    however you have to again configure your location manager after the app relaunches .

    something like this -

    if ([launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey] ) 
         {
    
            NSLog(@"Relaunched due to location update");
    
            NSLog(@"app woke up times ---- %d",ForTest);
    
            NSLog(@"Starting the location manager");
            self.locmanager = [[CLLocationManager alloc] init];
            [self.locmanager startMonitoringForRegion:(CLRegion)*region];
           // self.locmanager.pausesLocationUpdatesAutomatically = YES ;
        }
    

提交回复
热议问题