---
title: Liveness (biometric selfie)
description: Biometric selfie capture with embedded liveness verification, returning the captured frame as Base64 and JWT.
canonical: https://developer.unico.io/dual-api/developers/sdks-and-tools/ios/capture-flow/capture-types/liveness
locale: en
generated_by: markdown-export
---

Biometric selfie capture with embedded liveness verification. The SDK guides the user until a biometrically valid frame is obtained via SmartFrames and returns the image as Base64 + JWT.

:::secondary[Capability]
This capture type uses the **Liveness** capability. For a conceptual overview of how Liveness works, refer to the Liveness capability page.
:::

## How it works

The SDK manages the full capture session:

1. Opens the camera with the SmartFrame overlay.
2. Guides the user to position their face within the frame.
3. Validates liveness — the session only completes when the user is physically present.
4. Returns a `SelfieResult` (alias `ResultCamera`) object with `base64` and `encrypted` (JWT).

## Camera mode (smart capture)

The SDK has **intelligent framing** and **automatic capture** enabled by default. Configure the camera mode in your builder as follows:

### Swift

  ```swift
  unicoCheck.setSmartFrame(true)
  unicoCheck.setAutoCapture(true)
  ```

### Objective-C

  ```objectivec
  [unicoCheck setSmartFrame:true];
  [unicoCheck setAutoCapture:true];
  ```

## Starting a liveness capture

****Step 2** — Implement `SelfieCameraDelegate` and `AcessoBioSelfieDelegate`**

These delegates handle the selfie capture result callbacks:

  | Method | Description |
  |---|---|
  | `onSuccessSelfie(result)` | Capture succeeded — returns `SelfieResult` with `base64` (preview) and `encrypted` (JWT for the API) |
  | `onErrorSelfie(errorBio)` | Capture failed — returns an `ErrorBio` with code and description |

  :::warning[Token expiry]
  The interval between generating `encrypted` and submitting it to the API must not exceed **10 minutes**.
  :::

  ### Swift

    ```swift
    class ViewController: UIViewController, AcessoBioManagerDelegate,
      SelfieCameraDelegate, AcessoBioSelfieDelegate {

      func onSuccessSelfie(_ result: SelfieResult!) { }
      func onErrorSelfie(_ errorBio: ErrorBio!) { }
    }
    ```

### Objective-C

    ```objectivec
    // .h
    @interface ViewController: UIViewController <AcessoBioManagerDelegate,
      SelfieCameraDelegate, AcessoBioSelfieDelegate> {
      AcessoBioManager *unicoCheck;
    }

    // .m
    - (void)onSuccessSelfie:(SelfieResult *)result {
        NSLog(@"%@", result.base64);
    }

    - (void)onErrorSelfie:(ErrorBio *)errorBio { }
    ```

****Step 3** — Call `prepareSelfieCamera` and `open`**

Call `prepareSelfieCamera` passing the SDK config. When the camera is ready, the `onCameraReady` event is triggered with an `AcessoBioCameraOpenerDelegate` — open the camera through the `open()` method:

  - `onCameraReady(cameraOpener)` — camera is ready; call `open(self)`.
  - `onCameraFailed(message)` — camera preparation failed (`ErrorPrepare` is an extension of `ErrorBio`).

  ### Swift

    ```swift
    @IBAction func openCamera(_ sender: Any) {
      unicoCheck.build().prepareSelfieCamera(self, config: YourUnicoConfigClass())
    }

    func onCameraReady(_ cameraOpener: AcessoBioCameraOpenerDelegate!) {
      cameraOpener.open(self)
    }

    func onCameraFailed(_ message: ErrorPrepare!) { }
    ```

### Objective-C

    ```objectivec
    - (IBAction)openCamera:(UIButton *)sender {
        [[unicoCheck build] prepareSelfieCamera:self config:[YourUnicoConfigClass new]];
    }

    - (void)onCameraReady:(id)cameraOpener {
        [cameraOpener open:self];
    }

    - (void)onCameraFailed:(ErrorPrepare *)message { }
    ```

For the full result handling, see [Receiving the result](/developers/sdks-and-tools/ios/capture-flow/receiving-the-result).