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 { }
The prepareSelfieCamera method provides an overload that accepts metadata via PrepareInfo to assist in identifying the user session and the flow:
externalUserId(String, required) — User identifier within your system. Automatically hashed using SHA-256 before transmission.useCase(String, optional) — Identifier for the context or flow currently running (e.g.,"account_opening","password_recovery"). Transmitted in plain text.
- Swift
- Objective-C
let prepareInfo = PrepareInfo(
externalUserId: "external_user_id",
useCase: "use_case"
)
unicoCheck.build().prepareSelfieCamera(
self,
config: YourUnicoConfigClass(),
prepareInfo: prepareInfo
)
PrepareInfo *prepareInfo = [[PrepareInfo alloc]
initWithExternalUserId:@"external_user_id" useCase:@"flow_id"];
[[unicoCheck build] prepareSelfieCamera:self
config:[YourUnicoConfigClass new]
prepareInfo:prepareInfo];
For the full result handling, see Receiving the result.