Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Location Manager - isAuthorizedForPreciseLocation doesn't seem to exist

In the LocationManager's desiredAccuracy documentation page, Apple says

If your app isn’t authorized to access precise location information (isAuthorizedForPreciseLocation is false), changes to this property’s value have no effect; the accuracy is always kCLLocationAccuracyReduced.

I can't find this attribute anywhere, and no documentation about it either. Can someone give me some insight into this, please?

like image 651
Diogo Ferrer Avatar asked Jan 24 '23 21:01

Diogo Ferrer


2 Answers

Swift

   if #available(iOS 14.0, *) {
            if locationManager != nil {
                switch locationManager!.accuracyAuthorization {
                case .fullAccuracy:
                    print("Full Accuracy")
                case .reducedAccuracy:
                    print("Reduced Accuracy")
                @unknown default:
                    print("Unknown Precise Location...")
                }
            }
        }
like image 170
user3826696 Avatar answered May 04 '23 18:05

user3826696


Desired accuracy is a new iOS 14 setting exposed to users in every app's location permission page like below.

If the user changes this to be off, this blocks beacon detections, core bluetooth scanning and nearby interaction scanning. Lat/lon location updates from CoreLocation are degraded to be similar to what you get from cell towers. Read more in my answer here

Desired Accuracy Setting

like image 32
davidgyoung Avatar answered May 04 '23 16:05

davidgyoung