문서 캡처
신분증 문서 캡처. SDK가 사용자의 문서 위치를 안내하는 프레임을 제공하며, 위치를 잡은 후 사용자가 버튼을 클릭하여 사진을 캡처합니다.
콘텐츠 유효성 검사 없음
SDK는 캡처되는 내용에 대한 어떠한 유형의 유효성 검사도 수행하지 않습니다.
사용 가능한 문서 프레임
| 프레임 | 설명 |
|---|---|
DocumentEnums.CPF | CPF 캡처 |
DocumentEnums.CNH | 펼쳐진 CNH 캡처 |
DocumentEnums.cnhFrente | CNH 앞면 캡처 |
DocumentEnums.cnhVerso | CNH 뒷면 캡처 |
DocumentEnums.RG | 펼쳐진 RG 캡처 |
DocumentEnums.rgFrente | RG 앞면 캡처 |
DocumentEnums.rgVerso | RG 뒷면 캡처 |
DocumentEnums.none | 다른 문서를 위한 범용 직사각형 프레임 |
범용 프레임
특정 프레임이 없는 문서를 캡처해야 하는 경우(예: RNE), DocumentEnums.none을 사용하세요 — 모든 캡처를 안내하는 데 사용할 수 있는 범용 직사각 형 프레임입니다.
지원되는 문서 유형의 전체 목록은 API 레퍼런스 > Enums를 참조하세요.
문서 캡처 시작하기
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단계 — DocumentCameraDelegate 및 AcessoBioDocumentDelegate 구현
이 델리게이트들은 문서 캡처 결과 콜백을 처리합니다:
| 메서드 | 설명 |
|---|---|
onSuccessDocument(result) | 캡처 성공 — base64(미리보기)와 encrypted(API용 JWT)가 포함된 DocumentResult 반환 |
onErrorDocument(errorBio) | 캡처 실패 — 코드와 설명이 포함된 ErrorBio 반환 |
- Swift
- Objective-C
class ViewController: UIViewController, AcessoBioManagerDelegate,
DocumentCameraDelegate, AcessoBioDocumentDelegate {
func onSuccessDocument(_ result: DocumentResult!) { }
func onErrorDocument(_ errorBio: ErrorBio!) { }
}
// .h
@interface ViewController: UIViewController <AcessoBioManagerDelegate,
DocumentCameraDelegate, AcessoBioDocumentDelegate> {
AcessoBioManager *unicoCheck;
}
// .m
- (void)onSuccessDocument:(DocumentResult *)result {
NSLog(@"%@", result.base64);
}
- (void)onErrorDocument:(ErrorBio *)errorBio { }
3단계 — prepareDocumentCamera 및 openDocument 호출
SDK 구성을 전달하여 prepareDocumentCamera를 호출합니다. 카메라가 준비되면 AcessoBioCameraOpenerDelegate와 함께 onCameraReadyDocument가 트리거됩니다 — openDocument()를 사용하여 카메라를 열고 원하는 DocumentEnums를 전달합니다:
onCameraReadyDocument(cameraOpener)— 카메라가 준비됨;openDocument(.CNH, delegate: self)를 호출합니다.onCameraFailedDocument(message)— 카메라 준비 실패(ErrorPrepare는ErrorBio의 확장).
- Swift
- Objective-C
@IBAction func openCamera(_ sender: Any) {
unicoCheck.build().prepareDocumentCamera(self, config: YourUnicoConfigClass())
}
func onCameraReadyDocument(_ cameraOpener: AcessoBioCameraOpenerDelegate!) {
cameraOpener.openDocument(DocumentEnums.CNH, delegate: self)
}
func onCameraFailedDocument(_ message: ErrorPrepare!) { }
- (IBAction)openCamera:(UIButton *)sender {
[[unicoCheck build] prepareDocumentCamera:self config:[YourUnicoConfigClass new]];
}
- (void)onCameraReadyDocument:(id)cameraOpener {
[cameraOpener openDocument:DocumentCNH delegate:self];
}
- (void)onCameraFailedDocument:(ErrorPrepare *)message { }
전체 결과 처리 방법은 결과 수신을 참조하세요.