问题
Is geofence accuracy dependent on locationManager’s accuracy or distance filter? Or they are independent of each other because geofence is managed by the OS and uses Wifi/Cell tower info?
For example:
locationManager
locationManager.distanceFilter = 1250;
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
region
let title = "Lorrenzillo's"
let coordinate = CLLocationCoordinate2DMake(37.703026, -121.759735)
let regionRadius = 550.0
let region = CLCircularRegion(center: CLLocationCoordinate2D(latitude: coordinate.latitude,
longitude: coordinate.longitude), radius: regionRadius, identifier: title)
The 550
(radius) is less than kCLLocationAccuracyKilometer
...so would the geofence trigger as expected?
From what I understand the distanceFilter
has no effect on the geofence’s accuracy.
I’m just not sure if the desiredAccuracy
of the manager would affect geofence’s accuracy.
回答1:
The question makes no sense; you are comparing apples and tigers. Geofencing and your app's location manager have nothing at all to do with each other.
Geofencing using a circular region is performed for you by the system. Your location manager doesn't do any geofence-related locating. The system does not use, and knows nothing of, your app's location manager or its settings; indeed, your app will probably not even be running.
(You will, of course, need a location manager in order to have a location manager delegate so that you can receive callbacks from the system when the user crosses the geofence boundary, but your location manager is still not doing any locating related to geofencing.)
来源:https://stackoverflow.com/questions/47098619/is-geofence-accuracy-dependent-on-locationmanager-s-accuracy-or-distance-filter