For the complete documentation index, see llms.txt. This page is also available as Markdown.

iOS

The CafFaceLivenessLite iOS SDK reports errors through your CafFaceLivenessLiteDelegate. When a run cannot start or cannot finish, the SDK calls didFinishWithError(type:description:).

extension YourViewController: CafFaceLivenessLiteDelegate {
    func didFinishWithError(type: CafErrorType, description: String) {
        handleError(type, description)
    }
}

An error is always the last callback of a run: after it, no other result callback is sent for that run.

Where Errors Can Happen

Step
What can go wrong
Error type

startSDK call

setup was not called.

invalidOptionsException

Camera permission

The user denied camera access.

cameraPermission

Security check

The device is jailbroken, hooked or debugged.

securityException

Session creation

No connection, a server error, a token not valid for this flow, or an incomplete session.

serverException, tokenException, invalidResponseException or unsupportedDevice

Capture

Connection lost, server error, unsupported device, time limit or a capture already active.

networkException, serverException, unsupportedDevice, userTimeoutException, captureAlreadyActiveException or cameraPermission

Capture monitoring

A security threat appears while the camera is open.

securityException

Any step

An unexpected problem not mapped to a specific type.

unexpectedErrorException

setup and prewarm() never report errors:

  • setup only stores the configuration. It is checked when you call startSDK.

  • prewarm() is an optimization. If it fails, startSDK requests the session again and reports any problem from there.

What Your App Should Do

  1. Log the details. Send type and description to your logs or crash reporting tool.

  2. Show your own message. Map the type to a localized message. Do not show description or enum names to your users.

  3. Retry only when it can help. Each error type in Error Handling says whether a new attempt helps.

Category
Types

Integration

invalidOptionsException, tokenException, invalidResponseException

User

cameraPermission

Temporary

networkException, serverException, userTimeoutException, captureAlreadyActiveException

Device

securityException, unsupportedDevice

Other

unexpectedErrorException

cancelled() is not an error: the user closed the capture screen. Go back to the previous screen without an error message.

Next Steps

For every error type in detail, with the recommended user message: Error Handling

Last updated