Does anyone know any knowledge about this:
- (void) startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy
I am trying to implement it in my project, but:
- (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
never called?
Does anyone have sample code or do you know why this is happening?
My code is as follows. I created such a method in my own LocationManager class:
- (void) locationManagerStartMonitoringRegion:(CLRegion *)region withAccuracy:(CLLocationAccuracy)accuracy { NSLog(@"Start Monitoring"); [locationManager startMonitoringForRegion:region desiredAccuracy:accuracy]; NSLog(@"Monitored Regions: %i", [[locationManager monitoredRegions] count]); }
Then I call it like this:
CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(51.116261, -0.853758); CLRegion *grRegion = [[CLRegion alloc] initCircularRegionWithCenter:coordinates radius:150 identifier:[NSString stringWithFormat:@"grRegion%i", value]]; [locationManager locationManagerStartMonitoringRegion:grRegion withAccuracy:kCLLocationAccuracyBest];
I get NSLog:
2011-01-30 19: 52: 26.409 TestingLocation [10858: 307] Start monitoring
2011-01-30 19: 52: 27.103 TestingLocation [10858: 307] Controlled regions:
But never get an NSLog:
- (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { NSLog(@"Entered Region"); }
or
- (void) locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error { NSLog(@"monitoringDidFailForRegion: %@",error); }
thanks
objective-c iphone ios4 cllocationmanager cllocation
jodm
source share