Geo-Fencing didEnterRegion and didExitRegion methods not called?

前端 未结 1 921
慢半拍i
慢半拍i 2021-01-23 08:22

Hi Guys Am working on Geo-Fencing! Location manager didDetermineState is calling properly but when i entered region didEnterRegion and didExitRegion never been invoked.

相关标签:
1条回答
  • 2021-01-23 08:28

    Please try to call on main thread.

    if ([CLLocationManager locationServicesEnabled])
        {
            [self performSelectorOnMainThread:@selector(updateLocation) withObject:self waitUntilDone:NO];
        }
    
    
    - (void)updateLocation
    {
         arr_region=[[NSMutableArray alloc] init];
        self.locationManager = [[CLLocationManager alloc] init];
        self.locationManager.delegate = self;
        self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
         self.locationManager.pausesLocationUpdatesAutomatically = NO;
        [locationManager startUpdatingLocation];
    }
    

    i hope it helpful.

    0 讨论(0)
提交回复
热议问题