Skip to main content

Check for Settings Errors

Getting Fairmatic SDK settings on demand

If you want to check for the current errors in the SDK, you can do it using Fairmatic.getSettings(completionHandler) method. This method returns an object of the Settings class, and you can use the retrieved settings errors to determine whether any action is needed to rectify settings that affect SDK functionality.

func checkForFairmaticErrors() {
Fairmatic.getSettings { settings in
guard settings.errors.isEmpty else {
NSLog("No settings errors found.")
return
}

for settingsError in settings.errors {
switch settingsError.errorType {
case .locationServiceOff:
print("Location services off")
case .locationPermissionNotAuthorized:
print("Location permission not authorized. Make sure you allow always access to location")
case .locationAccuracyAuthorizationReduced:
print("Location accuracy reduced")
case .activityPermissionNotAuthorized:
print("Motion and fitness permission not authorized")
@unknown default:
print("-")
}
}
}
}