IOS: CLLocationManager didEnterRegion not called

I managed to successfully register a region or monitoring, I know this because the method was launched didStartMonitoringForRegion.

I have a simple test application with one MKMapViewwhere I can see my current location, I also have my region drawn on the map as a red circle so that I can "physically" see at what point I enter or exit this region. In the methods didEnterRegionand didExitRegionI run UIAlertView.

Some time ago, I decided to leave the office and take a walk with my iPhone 4 to make sure that it worked. I started in the middle of the region (about 200 m in radius), my application was in the foreground all the time. I went through a couple of blocks and left the region, nothing happened.

I read on SO (I think) that sometimes it only works when leaving the region a certain distance, so I continued to walk.

After 200 meters or so, I gave up, UIAlertViewstill not showing up, and began to return. Obviously, after re-entering the area, didEnterRegionhe did not shoot either.

I do not call [locationManager startUpdatingLocation]anywhere in my code, should I be ??? I just create a region and call [locationManager startMonitoringForRegion].

CLLocationManagerDelegateis my app delegate, and it seems great as mine didStartMonitoringForRegionworks correctly.

Have I missed anything else?

+5
source share
2 answers

, . , , startMonitoringForRegion.

, :

  • [CLLocationManager regionMonitoringAvailable] YES
  • CLLocationManager.monitoredRegions

: , 3-5 .

iOS 6 1 400 iPhone 4S . ( iOS 5 1 150 iPhone 4S .) 3 - 5 , .

, 500 . , . , .

, .

+2

, ( ):

, , , , :

→ → .

, , , - .

0

All Articles