I am developing an application for iPhone running on iOS5 and cannot configure startMonitoringForRegion:desiredAccuracy: when I call the startMonitoringForRegion:desiredAccuracy: method with the click of a button.
It works fine in the simulator when I print out areas in monitoredRegions , but when working on a real iPhone 4, monitoredRegions always empty. The didEnterRegion: and didExitRegion: also not didExitRegion: to be called.
Another mysterious fact is that on the BOTH simulator and iPhone 4 device, the CLLocationManagerDelegate didStartMonitoringForRegion: method is also not called.
Would thank for the help here, thanks!
EDIT: this is the method that I call with a button click:
-(void) queueGeofence: (CLLocationCoordinate2D)selectedBranch userCoordinate:(CLLocationCoordinate2D)userCoordinate radius: (CLLocationDegrees)radius { geofence = [[CLRegion alloc] initCircularRegionWithCenter:selectedBranch radius:radius identifier:@"geofence"]; CLLocationAccuracy acc = kCLLocationAccuracyNearestTenMeters; [locationManager startMonitoringForRegion:geofence desiredAccuracy:acc]; [CLLocationManager regionMonitoringEnabled]; NSLog([CLLocationManager regionMonitoringEnabled] ? @"regionMonitoringEnabled:Yes" : @"regionMonitoringEnabled:No"); NSLog([CLLocationManager regionMonitoringAvailable] ? @"regionMonitoringAvailable:Yes" : @"regionMonitoringAvailable:No"); NSLog(@"LOCATIONMANAGER monitored regions: %@", [locationManager monitoredRegions]}); }
Regional monitoring is enabled and available, but monitoredRegions still does not return anything.
source share