-->

Will iOS region monitoring call didEnterRegion on

2019-01-15 09:54发布

问题:

Will iOS region monitoring launch my app in the background if the user enters a region that was successfully being monitored for prior to the app being terminated?

I know that the significant change API will do so and will let me know at launch time via the inclusion of the UIApplicationLaunchOptionsLocationKey key. If region monitoring will wake my app up out of a terminated state too, then what does the launch process look like? Is there a special key I should be looking for?

回答1:

Yes, see Region Monitoring

In iOS, regions associated with your app are tracked at all times, including when your app is not running. If a region boundary is crossed while an app is not running, that app is relaunched into the background to handle the event. Similarly, if the app is suspended when the event occurs, it is woken up and given a short amount of time (around 10 seconds) to handle the event.



回答2:

I have been searching for similar answer, but came across this: Region monitoring in ios 7

Seems like if the app is manually terminated by the user in iOS 7, location notifications will not wake the app to process it. Apple employee has commented here https://devforums.apple.com/thread/209302?tstart=0