简体   繁体   中英

Swift Region Monitoring Local Notification trigger

I'm doing an app to trigger a local notification when a region is entered. However, sometimes when the phone is locked, the notifications didn't pop up even I've been in the region area for a while. The notification popup will show only when the power/home button is pressed(phone still in locked mode).

In general, all seems to be working except that sometimes the notification will show only when power/home button is pressed to awake the phone although it is still locked.

Hope someone can enlighten me please! =)

According to the developer documentation . In core-location framework, two services can give you the current location information.

  1. The standard location service is a configurable, general-purpose solution for getting location data and tracking location changes for the specified level of accuracy.

  2. The significant-change location service delivers updates only when there has been a significant change in the device's location, such as 500 meters or more.

You need to use standard location services to keep monitoring location in background

If your iOS app must keep monitoring location even while it's in the background, use the standard location service and specify the location value of the UIBackgroundModes key to continue running in the background and receiving location updates. (In this situation, you should also make sure the location manager's pausesLocationUpdatesAutomatically property is set to YES to help conserve power.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM