Geofencing didEnterRegion,didExitRegion function not Calling in iphone 5S iOS8.1

南笙酒味 提交于 2019-12-01 22:22:17
Jack Patoliya

I have face same problem, Following are the steps I was follow and get succeed.

  • After add your geofence Array data in locationmanager. Use below code for the same.

    for (CLRegion *monitored in [locationManagerGeofence monitoredRegions])
     {
         [locationManagerGeofence stopMonitoringForRegion:monitored];
     }
     self.geofencesArray = [NSMutableArray arrayWithArray:[self buildGeofenceData]];
     if([CLLocationManager regionMonitoringAvailable])
     {
         for (CLRegion *region in self.geofencesArray)
         {
             [locationManagerGeofence startMonitoringForRegion:region desiredAccuracy:kCLLocationAccuracyBest];
         }
     }
     else
     {
         [BB_Global displayAlertWithTitle:@"" message:@"This app requires region monitoring features which are unavailable on this device."];
     }
    
  • Make sure your wifi is On.
  • Check your start monitoring for region with below delegate.

    -(void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region
    {
        NSLog(@"Started monitoring %@ region", region.identifier);
    }
    
  • Use these two delegate method for geofence. 1) DidEnter 2)DidExit

  • Test your device with some movement or some other place (Make sure set your geofence set with different location with 100 meter radius). for the same you implement local notification in DidEnter and DidExit method so no need to debug. once your method will be call that time local notification is fire.
  • Get Success :)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!