CLLocationManager: didEnterRegion & didExitRegionAlert method did not called

283 Views Asked by At

I am using CLRegion for geofencing. I monitored CLCircularRegion set for notifyOnExit and notifyOnEntry. Here is my code:

 CLLocationCoordinate2D coordinateGYM = CLLocationCoordinate2DMake(lat,lng);
    CLCircularRegion *regionSet = [[CLCircularRegion alloc]initWithCenter:coordinateGYM radius:RADIUS identifier:strTitle];
    if(isExit)
    {
        regionSet.notifyOnExit = YES;
        regionSet.notifyOnEntry = NO;
    }
    else
    {
        regionSet.notifyOnExit = NO;
        regionSet.notifyOnEntry = YES;
    }
    [self.locationManager startMonitoringForRegion:regionSet];
    [self.locationManager startUpdatingHeading];

Before monitor the region I try to removed all the region which motinored before it. Then I monitored with region. But it will directly invote monitoringDidFailForRegion delegate method with Error: The operation couldn’t be completed. (kCLErrorDomain error 4.) error. And it will not called delegate method.

-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{

-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
}

Can anyone help me what is error in my code? Thanks,

0

There are 0 best solutions below