Instance Method

canEvaluatePolicy(_:error:)

Assesses whether authentication can proceed for a given policy.

Declaration

func canEvaluatePolicy(_ policy: LAPolicy, error: NSErrorPointer) -> Bool

Parameters

policy

The policy to evaluate. For possible values, see LAPolicy.

error

If the method fails, it uses this parameter to return an error detailing what went wrong. See LAError.Code for possible error codes.

Specify nil for this parameter to ignore any errors.

Return Value

true if the policy can be evaluated, otherwise false.

Discussion

Some policies impose requirements that must be met before authentication can proceed. For example, a policy that requires biometrics can’t authenticate if Touch ID or Face ID is disabled. This method tests all the prerequisites for a given policy.

Don’t store the return value from this method because it might change as a result of changes in the system. For example, a user might disable Touch ID after you call this method. However, the reported value does remain consistent until your app enters the background.

See Also

Checking Availability

enum LAPolicy

The set of available local authentication policies.

var biometryType: LABiometryType

The type of biometric authentication supported by the device.

enum LABiometryType

The set of available biometric authentication types.