4

I'm testing region monitoring on the Simulator. Both [CLLocationManager regionMonitoringAvailable] and [CLLocationManager regionMonitoringEnabled] return YES. I added App registers for location updates in plist. I have a global location manager in the AppDelegate and startUpdatingLocation works fine both in foreground and backgrund.

Then I have

CLLocationCoordinate2D p = CLLocationCoordinate2DMake(45.488, 9.16);
CLRegion *region=[[CLRegion alloc] initCircularRegionWithCenter:p radius:100.0 identifier:@"emanuele"];
CLLocationAccuracy acc=200.0;
[locationManager startMonitoringForRegion:region desiredAccuracy:acc];

But when testing on the simulator I'm not able to get neither didEnterRegion nor monitoringDidFailForRegion. Am I doing something wrong or missing something?

Thanks a lot in advance.

Emanuele Fumagalli
  • 1,476
  • 2
  • 19
  • 31

2 Answers2

2

It looks like your radius is only 100 meters but your accuracy is set to 200 meters. Try setting accuracy to best and see if you have improved results.

It also doesn't look like your coords are not accurate enough to get down to 100 meters. Try more precise coords with better accuracy. Everything else looks fine.

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
  • Hello @Bill, I am a little bit puzzled. You said that `significantLocationUpdate` would not be available for simulator because it uses cell tower handoffs (http://stackoverflow.com/questions/8541973/simulating-location-changes-for-startmonitoringsignificantlocationchanges). So, I expected the similar answer in here for region monitoring as well, but ...!? Should region monitoring work on simulator? (I am observing otherwise...) – barley Jan 11 '12 at 14:40
  • I have been able to test region monitoring just fine in the simulator when it is set up correctly. I use the custom location in Debug-->Location. I just haven't seen a good way to test for significant changes in the simulator. Hope this helps. – Bill Burgess Jan 11 '12 at 15:19
  • I see. It seems in my code, `didEnterRegion` fires, but `didExitRegion` does not. I will triple check my code when I have time though. Thanks for the info! – barley Jan 11 '12 at 16:54
-1

I think the region monitoring in the simulator is broken. The region monitoring in my app (GeoControl) works fine when it runs on the device but not on the simulator. specifically, the didEnterRegion and didExitRegion are not called in the simulator when I use Debug>Location>FreewayDrive.

RawMean
  • 8,374
  • 6
  • 55
  • 82