didExitRegion doesnt get trigger when the app is terminated CLLocationManagerDelegate

131 views Asked by At

I have been testing my application for about a week now, Our app takes some regions for example in the current testing we have 6 regions each region has 120m radius. The app is built by following this article https://www.raywenderlich.com/17649843-geofencing-with-core-location-getting-started

Problem

  • When I leave the building by walking and even after 1 kilometre the app doesn't trigger didExitRegion when it is terminated. In fact when you open the app didExitRegion gets called immediately and I get the exit event.

I'm unable to figure that out why my application is not being wakened by the Location event, even though Apple claims that for every region event the app will be wakened by OS.

I have set permission to always.

1

There are 1 answers

0
Mudassir Zulfiqar On

I just figured that out the didFinishLaunchingWithOptions was always being called when there is an incoming event in region monitoring. But the locationManager variable which was assigned globally in AppDelegate was nil, So I had to re initialise into

didFinishLaunchingWithOptions

Now my app gets event even the app is terminated