Location trigger doesn't enable local notification on real device, only on simulator

67 Views Asked by At

I am implementing simple app which adds hardcoded local notification so Notification Center with location triggers. I have used this tutorial https://github.com/jgsamudio/LocationNotifier to implement it. However, notification shows on simulator, but not on real device.

I simulate location for simulator like this:

Features -> Location -> Current Location (I change location to exit and enter the desired region)

Result: notifications are pending and I see them in moment of entering/existing region.

For device:

Debug -> Simulate Location -> London, England (I change location to other or add custom one to exit and enter the desired region)

Result: notifications are pending and I can't see them in moment of entering/existing region.

Is there anyone who faced this problem? How did you solve it?

I have tried:

  1. Using different iOS: 15.6, 16.4, 16.5 (Xcode 14.3.1)
  2. Walking with pending notifications on my device along the street to trigger them
  3. UNTimeIntervalNotificationTrigger works fine for all app states and both simulator and device. I can potentially schedule time notification when water a region in func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {...} but it seems like a dirty hack
  4. This tutorial https://www.kodeco.com/20690666-location-notifications-with-unlocationnotificationtrigger also leads to same behaviour (doesn't show notifications on device)

Desireed result:

See notifications triggered by UNLocationNotificationTrigger(region: <CLRegion>, repeats: <Bool>) on my device

0

There are 0 best solutions below