StartMonitoringForRegion in iPhone Simulator

I am testing cloud monitoring on the Simulator. Both [CLLocationManager regionMonitoringAvailable] and [CLLocationManager regionMonitoringEnabled] return YES. I added App registers to update location in plist. I have a global location manager in AppDelegate and startUpdatingLocation works great both in the foreground and on the 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 a simulator, I cannot get either didEnterRegion or monitoringDidFailForRegion. Am I doing something wrong or is something missing?

Thank you very much in advance.

+4
source share
2 answers

It looks like your radius is only 100 meters, but your accuracy is set to 200 meters. Try to accurately establish the accuracy and see if the results are improved.

It also doesn't seem like your coordinates are accurate enough to go down to 100 meters. Try more accurate coordinates with better accuracy. Everything else looks good.

+2
source

I think that the monitoring of the region in the simulator is violated. Area monitoring in my application (GeoControl) works great when it works on the device, but not on the simulator. in particular, didEnterRegion and didExitRegion are not called in the simulator when I use Debug> Location> FreewayDrive.

-1
source

Source: https://habr.com/ru/post/1387177/


All Articles