Emanuele Fumagalli
Emanuele Fumagalli

Reputation: 1484

startMonitoringForRegion in iPhone Simulator

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.

Upvotes: 4

Views: 2821

Answers (2)

RawMean
RawMean

Reputation: 8755

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.

Upvotes: -1

Bill Burgess
Bill Burgess

Reputation: 14164

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.

Upvotes: 2

Related Questions