3

I'm trying to call didEnterRegion and didExitRegion for geofencing events when the app is killed (double tap home and swipe up by the user), but I'm not sure if this is even possible. From what I've seen, such as here, it isn't possible. However, I was wondering if something had changed in iOS 11, or if there was another way to do this?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
LFHS
  • 295
  • 1
  • 2
  • 15
  • I havent seen anything serious along those lines changed in iOS 11, so `applicationWillTerminate` should work the same as you might have used it before. – KSigWyatt Nov 18 '17 at 15:42
  • Take a look at [my answer from a few years ago](https://stackoverflow.com/a/11730391/312312) – Lefteris Nov 18 '17 at 16:40

1 Answers1

3

After running many tests, I can confirm that Geofence Events are called, even when the app is terminated (swipe up). However, the user must have authorized location to be used when the app isn't running, and other background location functions, such as didUpdateLocation will not be called.

LFHS
  • 295
  • 1
  • 2
  • 15
  • Things like regionMonitoring, SLC and visit location and even push notifications* services are managed by the OS. Depending on *your* setup they show you alerts on the iPhone/NotificationCenter **even** if app was user-terminated. **If** you interact with those notifications to open the app, then you can configure the app that upon launching the app with notification do e.g. `startUpdatingLocation`. (*silent notifications aren't delivered to the app if app is user-terminated) – mfaani Nov 30 '17 at 03:11
  • Also see [here](https://stackoverflow.com/a/47099174/5175709) and its other answers. – mfaani Nov 30 '17 at 03:14