Initialization
Implement the AcessoBioConfigDataSource protocol in your class:
- Swift
- Objective-C
import AcessoBio
class YourUnicoConfigClass: AcessoBioConfigDataSource {
func getBundleIdentifier() -> String {
return "<YOUR_MOBILE_BUNDLE_IDENTIFIER>"
}
func getHostKey() -> String {
return "<YOUR_SDK_KEY>"
}
}
// .h
#import <AcessoBio/AcessoBioManager.h>
#import <AcessoBio/AcessoBio-Swift.h>
@interface YourUnicoConfigClass: AcessoBioConfigDataSource {}
@end
// .m
@implementation YourUnicoConfigClass
- (NSString * _Nonnull)getBundleIdentifier {
return @"<YOUR_MOBILE_BUNDLE_IDENTIFIER>";
}
- (NSString * _Nonnull)getHostKey {
return @"<YOUR_SDK_KEY>";
}
@end
Import the SDK and implement the AcessoBioManagerDelegate interface within the ViewController you want to use. Instantiate the builder, providing the context, and override the callback methods with the business logic of your application:
- Swift
- Objective-C
import UIKit
import AcessoBio
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() { }
}
#import "ViewController.h"
#import <AcessoBio/AcessoBio.h>
@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.
The choice of environment is made during initialization. Use the EnvironmentEnum type:
EnvironmentEnum.PROD— production environmentEnvironmentEnum.UAT— UAT environment
- Swift
- Objective-C
unicoCheck.setEnvironment(.UAT)
[unicoCheck setEnvironment:UAT];
For the full list of available environment types, refer to API Reference > Initialization API.
SDK authentication with the backend takes a few seconds. Initialize early (cold start of the app), not when the user taps the capture button — otherwise the user experiences lag between the tap and the camera opening.