라이브니스 (생체 인식 셀피)
내장된 라이브니스 검증을 통한 생체 인식 셀피 촬영입니다. SDK는 SmartFrames를 통해 생체 인식적으로 유효한 프레임이 획득될 때까지 사용자를 안내하고, 이미지를 Base64 + JWT로 반환합니다.
이 촬영 유형은 Liveness 기능을 사용합니다. Liveness 작동 방식에 대한 개념적 개요는 Liveness 기능 페이지를 참조하십시오.
SDK가 전체 촬영 세션을 관리합니다:
- SmartFrame 오버레이와 함께 카메라를 엽니다.
- 사용자가 프레임 내에 얼굴을 위치시키도록 안내합니다.
- 라이브니스를 검증합니다 — 사용자가 실제로 존재할 때만 세션이 완료됩니다.
base64와encrypted(JWT)가 포함된SelfieResult(별칭ResultCamera) 객체를 반환합니다.
SDK에는 기본적으로 지능형 프레이밍과 자동 촬영이 활성화되어 있습니다. 빌더에서 다음과 같이 카메라 모드를 설정합니다:
- Swift
- Objective-C
unicoCheck.setSmartFrame(true)
unicoCheck.setAutoCapture(true)
[unicoCheck setSmartFrame:true];
[unicoCheck setAutoCapture:true];
1단계 — AcessoBioManagerDelegate 구현
AcessoBioManagerDelegate는 SDK 라이프사이클 콜백을 처리합니다. 필수 메서드 4개를 구현하세요:
| 메서드 | 호출 시점 |
|---|---|
onErrorAcessoBioManager(error) | SDK 작동 중 오류 발생 |
onUserClosedCameraManually() | 사용자가 카메라를 수동으로 닫음 |
onSystemClosedCameraTimeoutSession() | 40초 세션 제한 도달 |
onSystemChangedTypeCameraTimeoutFaceInference() | 13초 동안 얼굴이 감지되지 않음 — 수동 캡처로 전환 |
- 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
위의 4개 델리게이트 메서드는 프로젝트에서 모두 생성해야 합니다 (로직이 없어도). 그렇지 않으면 프로젝트가 컴파일되지 않습니다.
2단계 — SelfieCameraDelegate 및 AcessoBioSelfieDelegate 구현
이 델리게이트들은 셀피 촬영 결과 콜백을 처리합니다:
| 메서드 | 설명 |
|---|---|
onSuccessSelfie(result) | 촬영 성공 — base64(미리 보기)와 encrypted(API용 JWT)가 포함된 SelfieResult 반환 |
onErrorSelfie(errorBio) | 촬영 실패 — 코드와 설명이 포함된 ErrorBio 반환 |
encrypted 생성과 API 제출 사이의 간격은 10분을 초과해서는 안 됩니다.
- 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 { }
3단계 — prepareSelfieCamera 및 open 호출
SDK 설정을 전달하며 prepareSelfieCamera를 호출합니다. 카메라가 준비되면 AcessoBioCameraOpenerDelegate와 함께 onCameraReady 이벤트가 트리거됩니다 — open() 메서드를 통해 카메라를 엽니다:
onCameraReady(cameraOpener)— 카메라 준비 완료;open(self)호출.onCameraFailed(message)— 카메라 준비 실패(ErrorPrepare는ErrorBio의 확장입니다).
- 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 { }
prepareSelfieCamera 메서드는 사용자 세션과 플로우를 식별하는 데 도움이 되는 PrepareInfo를 통해 메타데이터를 수락하는 오버로드를 제공합니다:
externalUserId(String, 필수) — 시스템 내 사용자 식별자. 전송 전에 SHA-256을 사용하여 자동으로 해시됩니다.useCase(String, 선택) — 현재 실행 중인 컨텍스트 또는 플로우의 식별자(예:"account_opening","password_recovery"). 일반 텍스트로 전송됩니다.
- 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];
전체 결과 처리 방법은 결과 수신을 참조하십시오.