Ranging Beacons only works when app running?

后端 未结 5 704
说谎
说谎 2021-01-29 23:05

I am having difficulties getting this to work for when the app is not running. I have locationManager:didRangeBeacons:inRegion: implemented and it is called when th

5条回答
  •  花落未央
    2021-01-29 23:41

    You are doing two separate operations here - 'ranging' beacons and monitoring for a region. You can monitor for a region in the background, but not range beacons.

    Therefore, your implementation of locationManager:didRangeBeacons:inRegion: won't get called in the background. Instead, your call to startMonitoringForRegion will result in one / some of the following methods being called:

    – locationManager:didEnterRegion:
    – locationManager:didExitRegion:
    – locationManager:didDetermineState:forRegion:
    

    These will get called in the background. You can at that point trigger a local notification, as in your original code.

提交回复
热议问题