Usage and Integration Guide

Initializing the SDK

To get started with the Unico Check iOS SDK, import the SDK and implement the AcessoBioManagerDelegate interface within the ViewController you want to use.

The implementation of this class is straightforward and can be done with just a few lines of code. All you need to do is instantiate the builder, providing the context and environment in question, and override the callback methods with the business logic of your application:

.m:
#import "ViewController.h"
#import <AcessoBio/AcessoBio.h>

@implementation ViewController: UIViewController
- (void)viewDidLoad {
    [super viewDidLoad];  
    unicoCheck = [[AcessoBioManager alloc]initWithViewController:self];
}

- (void)onErrorAcessoBioManager:(ErrorBio *)error {
  // your code
}

- (void)onSystemChangedTypeCameraTimeoutFaceInference {
  // your code
}

- (void)onSystemClosedCameraTimeoutSession {
  // your code
}

- (void)onUserClosedCameraManually {
  // your code
}
@end

Environment configuration

Configure the environment that will be used to run the SDK. Use the enumerated environment that contains the following enumerates:

  • PROD: for production environment;

  • UAT: for approval environment.

See how to implement it in the example below:

Implementing the Callback Functions

Note that, as shown in the previous example, the implementation of the AcessoBioManagerDelegate interface mainly involves configuring the callback methods. Each method is called in a specific situation in the SDK's return process.

You simply need to override the methods demonstrated in the previous step with the business logic of your application:

1

onErrorAcessoBio(ErrorBio errorBio)

When invoked, the method receives a parameter of type ErrorBio that contains details about the error. Learn more about the ErrorBio type in the error handling section.

2

onUserClosedCameraManually()

This method is invoked whenever the user manually closes the camera, such as when clicking the "Back" button.

3

onSystemClosedCameraTimeoutSession()

This method is invoked as soon as the maximum session time is reached (without capturing any image).

circle-exclamation

4

onSystemChangedTypeCameraTimeoutFaceInference()

This method is invoked as soon as the maximum time for face detection is reached (without detecting anything). In this case, the camera mode is automatically switched to manual capture mode (without the smart capture outline).

circle-exclamation

triangle-exclamation

Configuring Camera Mode

The SDK has intelligent framing and automatic capture configured and enabled by default. As a result, you should configure the camera mode in your builder as follows:

Implementing Delegates for Camera Events

The camera opening method needs to know what to do when it successfully captures an image or encounters an error during the process. "What to do" is informed to the camera opening method through the configuration of delegates that are called in success or error situations.

By configuring the delegates, you can specify what happens in your app in error situations (method onErrorSelfie) or success (method onSuccessSelfie) when capturing images.

To configure the delegates, you need to implement the SelfieCameraDelegate and AcessoBioSelfieDelegate interfaces:

onSuccess Method

When an image is successfully captured, this method is invoked and returns an object of type SuccessResult, which is later used in the REST API call.

The SuccessResult object returns 1 attribute: processId:

  • The processId attribute can be used to obtain information about the previously created process.

onErrorSelfie Method

When an error occurs during image capture, this method is invoked and returns an object of type ErrorBio:

Prepare and Open Camera

To proceed with opening the camera, you must first prepare it using the prepareSelfieCamera method. This method takes as parameters the implementation of the SelfieCameraDelegate class and the JSON containing the credentials generated in the previous step.

Once the camera is prepared, the onCameraReady event is triggered and receives an object of type AcessoBioCameraOpenerDelegate as a parameter.

You should override this method and open the camera using the object received through the open() method:

If any error occurs while preparing the camera, the onCameraFailed event is triggered. You should implement this method applying your app's business rules.

Last updated

Was this helpful?