问题
I wrote some test code that alerts me in the background when I've left a region or entered it. Works great with "Always" location access. — However, if I change the app's location access to "When In Use", it doesn't work anymore. Works again when reverted.
I was under the impression (as were others) that geofencing (region monitoring) on iOS should work without "Always" location access. Is there an entitlement or setting somewhere to enable it to work correctly?
The hollow arrow doesn't even appear in the status bar without "Always", which is kind of a tip-off that it's not supported without "Always" being turned on, but yeah....
回答1:
That's expected. Region monitoring, visit monitoring, significant Location Changes are handled on the OS level and to work need Always access. This is a screen shot from WWDC Core Location Best Practice Minute 14:09
来源:https://stackoverflow.com/questions/45764047/possible-to-use-geofencing-region-monitoring-on-ios-without-always-location