Skip to main content

iOS 14

In our iOS 13 Permissions guide, we mentioned that iOS 13 introduced the "request prompt" that allows a user to grant location permission once or while using the app, but not permanently.

In iOS 14, the user can now control the precision of location information in the request prompt. Users can now choose to toggle "Precise: On" or "Precise: Off". The default value is "Precise: On".

iOS 14 has a prompt that allows users to provide or deny Precise Location.

Precise location information in the background is crucial to Fairmatic SDK and our key features such as collision detection and automatic trip detection.

We recommend treating the lack of precise location the same as missing location permission. If the precise location access is missing, prompt the user to grant the required permission.

The following will only work on Xcode 12 (including betas) and above because the new location APIs are absent in Xcode 11.x and below.

Use the following code snippet to check for the availability of precise location on iOS 14.

//  Copyright (c) 2023 Fairmatic. All rights reserved.

import UIKit
import CoreLocation

class FMLocationManager: NSObject, CLLocationManagerDelegate {
private let locationManager: CLLocationManager

// This initializer should be called on main thread
override init() {
locationManager = CLLocationManager()
super.init()
locationManager.delegate = self
}

/// location permission changed callback for iOS13.x and below
func locationManager(_ manager: CLLocationManager,
didChangeAuthorization status: CLAuthorizationStatus) {
if status == .authorizedAlways {
print("location permission approved")
} else {
print("location permission denied")
}
}

/// location permission changed callback for iOS14 and above
/// if we don't implement this delegate, os will deliver the older
/// callback mentioned above as a fallback wherein we won't get the
/// precise location information.
@available(iOS 14.0, *)
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
if manager.authorizationStatus == .authorizedAlways &&
manager.accuracyAuthorization == .fullAccuracy {
print("location permission approved")
} else {
print("location permission denied")
}
}
}

The location settings has a toggle for Precise Location, which needs to be on.

The user should toggle 'Precise Location' to on.