Liveness (biometric selfie)
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.
This capture type uses the Liveness capability. For a conceptual overview of how Liveness works, refer to the Liveness capability page.
The SDK manages the full capture session:
- Opens the camera with the SmartFrame overlay.
- Guides the user to position their face within the frame.
- Validates liveness — the session only completes when the user is physically present.
- Returns a
SelfieResult(aliasResultCamera) object withbase64andencrypted(JWT).
The SDK has intelligent framing and automatic capture enabled by default. Configure the camera mode in your builder as follows:
- Swift
- Objective-C
unicoCheck.setSmartFrame(true)
unicoCheck.setAutoCapture(true)
[unicoCheck setSmartFrame:true];
[unicoCheck setAutoCapture:true];
Step 1 — Implement AcessoBioManagerDelegate
AcessoBioManagerDelegate handles the SDK lifecycle callbacks. Implement the four mandatory methods:
| Method | When it's called |
|---|---|
onErrorAcessoBioManager(error) | An error occurred during SDK operation |
onUserClosedCameraManually() | The user manually closed the camera |
onSystemClosedCameraTimeoutSession() | The 40-second session limit was reached |
onSystemChangedTypeCameraTimeoutFaceInference() | No face detected for 13 seconds — switches to manual capture |
- Swift
- Objective-C
class ViewController: UIViewController, AcessoBioManagerDelegate {
var unicoCheck: AcessoBioManager!
override func viewDidLoad() {
super.viewDidLoad()
unicoCheck = AcessoBioManager(viewController: self)
}
func onErrorAcessoBioManager(_ error: ErrorBio!) { }
func onUserClosedCameraManually() { }
func onSystemClosedCameraTimeoutSession() { }
func onSystemChangedTypeCameraTimeoutFaceInference() { }
}
@implementation ViewController: UIViewController
- (void)viewDidLoad {
[super viewDidLoad];
unicoCheck = [[AcessoBioManager alloc]initWithViewController:self];
}
- (void)onErrorAcessoBioManager:(ErrorBio *)error { }
- (void)onSystemChangedTypeCameraTimeoutFaceInference { }
- (void)onSystemClosedCameraTimeoutSession { }
- (void)onUserClosedCameraManually { }
@end
All four delegate methods above must be created in your project (even without any logic). Otherwise, the project will not compile successfully.
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 |
The interval between generating encrypted and submitting it to the API must not exceed 10 minutes.
- Swift
- Objective-C
class ViewController: UIViewController, AcessoBioManagerDelegate,
SelfieCameraDelegate, AcessoBioSelfieDelegate {
func onSuccessSelfie(_ result: SelfieResult!) { }
func onErrorSelfie(_ errorBio: ErrorBio!) { }
}
// .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; callopen(self).onCameraFailed(message)— camera preparation failed (ErrorPrepareis an extension ofErrorBio).
- Swift
- Objective-C
@IBAction func openCamera(_ sender: Any) {
unicoCheck.build().prepareSelfieCamera(self, config: YourUnicoConfigClass())
}
func onCameraReady(_ cameraOpener: AcessoBioCameraOpenerDelegate!) {
cameraOpener.open(self)
}
func onCameraFailed(_ message: ErrorPrepare!) { }
- (IBAction)openCamera:(UIButton *)sender {
[[unicoCheck build] prepareSelfieCamera:self config:[YourUnicoConfigClass new]];
}
- (void)onCameraReady:(id)cameraOpener {
[cameraOpener open:self];
}
- (void)onCameraFailed:(ErrorPrepare *)message { }
To use Smart Revalidation on ApiOnly (Native SDK + API), open the camera passing UnicoIDSmartOptions with the reference process and the use case. It requires iOS SDK 3.4.0 or later. For the accepted useCase values, see Smart Revalidation. For the fields, see the Capture API.
- Swift
- Objective-C
func onCameraReady(_ cameraOpener: AcessoBioCameraOpenerDelegate!) {
let idSmartOptions = UnicoIDSmartOptions(referenceProcessId: "reference_process_id", useCase: "use_case")
cameraOpener.open(self, idSmartOptions: idSmartOptions)
}
- (void)onCameraReady:(id<AcessoBioCameraOpenerDelegate>)cameraOpener {
UnicoIDSmartOptions *idSmartOptions = [[UnicoIDSmartOptions alloc] initWithReferenceProcessId:@"reference_process_id" useCase:@"use_case"];
[cameraOpener open:self idSmartOptions:idSmartOptions];
}
- Approved by silent authentication: the camera does not open, and
onSuccessSelfiereturns theencryptedJWT with no image. The image preview comes empty. - Escalated to facial biometry: the camera opens and the result is the same as a regular capture.
- No reference process: the camera runs the regular capture, without Smart Revalidation.
For the full result handling, see Receiving the result.