Constantly tracking user location on iOS

后端 未结 4 537
花落未央
花落未央 2021-02-09 05:09

I need to constantly monitor the position of an user to notify him when he gets near something interesting. Which is the correct way to achieve this?

I have not been abl

4条回答
  •  没有蜡笔的小新
    2021-02-09 05:58

    What you need is geofencing. In iOS it's called "region monitoring". You can start with startMonitoringForRegion: in the CLLocationManager guide. More detail is in the Region Monitoring Guide

    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.

提交回复
热议问题