Note that there are some explanatory texts on larger screens.

plurals
  1. PORegion monitoring in iOS: didEnterRegion fires but didExitRegion does not in simuator
    primarykey
    data
    text
    <p>I am using CLLocationManager to monitor regions in iOS. I set up the delegate in the normal way:</p> <pre><code>self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; </code></pre> <p>and implement several delegate functions including:</p> <pre><code>- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { NSLog(@"GeoFence: didEnterRegion"); } - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { NSLog(@"GeoFence: didExitRegion"); } </code></pre> <p>Then I start monitoring a region with:</p> <pre><code>CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(lat, lng); CLRegion *grRegion = [[CLRegion alloc] initCircularRegionWithCenter:coordinates radius:radius identifier:[NSString stringWithFormat:@"grRegion%i", 1]]; CLLocationAccuracy acc = kCLLocationAccuracyNearestTenMeters; [self.locationManager startMonitoringForRegion:grRegion desiredAccuracy:acc]; </code></pre> <p>with appropriate values for lat (51.116261), lng (-0.85300) and radius (200). After building and running the app in the iPhone 5.1 simulator, I use the location injection tool in Xcode 4.3 to move between a distant location to my target location and back again. Under this procedure, the didEnterRegion event correctly triggers but the didExitRegion never does. I also receive other delegate callbacks such as didUpdateToLocation. I have varied the pattern of simulated movements, used the simulator's location setting tool rather than Xcode's, and tried the same tests running the app on an iPhone 4S with iOS 5.1. All tests have the same result.</p> <p>I have ensured WiFi is enabled as suggested in other threads and looked through other questions on related topics in vain. Any suggestions as why one of the region transition events would fire, but not the other?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload