In this section, you will find all the necessary information for using and integrating the Unico IDCloud platform SDK into your iOS applications
In this section, you will find all the necessary information for using and integrating the Unico IDCloud platform SDK into your iOS applications for selfie capture
This guide has been designed to help you quickly and easily implement the Android SDK. Below, you'll find the step-by-step process for the complete integration. If you wish to customize the experience further, check out the iOS Customization section.
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 with the relevant context and override the callback methods with your application’s business logic:
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:
As shown in the previous example, the main task when implementing the AcessoBioManagerDelegate
interface is configuring the callback methods. Each method is called in response to a specific return from the SDK.
Simply override the methods illustrated in the previous step with your application’s business logic:
onErrorAcessoBioManager(_ error: ErrorBio!)
This method is invoked whenever any implementation error occurs using any SDK method. It receives an ErrorBio
parameter that contains error details. See the Error Handling section for more about ErrorBio
.
onUserClosedCameraManually()
This method is invoked when the user manually closes the camera, such as by clicking the "Back" button.
onSystemClosedCameraTimeoutSession()
This method is invoked when the maximum session time is reached (without capturing an image).
You can configure the session timeout in seconds using setTimeoutSession
. The default and minimum timeout is 40 seconds.
onSystemChangedTypeCameraTimeoutFaceInference()
This method is invoked when the maximum time for face detection is reached without detection.
The maximum time is 13 seconds. The mode is then switched to manual capture to facilitate the user’s action.
All the above methods must be created as indicated in your project (even without any logic); otherwise, the project won’t compile successfully.
The SDK is preconfigured with intelligent framing and automatic capture. Configure the camera mode in the builder as follows:
The false/true
values in the above methods do not alter the capture experience; they are solely used for the SDK's internal logic.
The camera launch method needs to know how to handle situations when an image is successfully captured or when an error occurs during the process. The handling instructions are passed to the camera launch method by setting delegates, which are called in cases of success or error.
Through delegate configuration, you can specify what actions your app should take in the event of an error (using the onErrorSelfie
method) or success (using the onSuccessSelfie
method) in capturing images.
To set up the delegates, you must implement the SelfieCameraDelegate
and AcessoBioSelfieDelegate
interfaces:
onSuccessSelfie
MethodUpon successful image capture, this method returns a SelfieResult
object for subsequent API requests:
The SelfieResult
object provides two attributes: base64
and encrypted
:
Use base64
for preview in the app;
Use encrypted
for sending to REST APIs.
The encrypted
attribute is strictly intended for sending the image through the by Client APIs. It should not be opened or serialized, as its characteristics may change without prior notice. Its use must be exclusive to interactions with the APIs to ensure the integrity and security of the data. Unico is not responsible for any damages arising from this practice, as modifications may occur unexpectedly.
The base64
and encrypted
files can vary in size due to several factors, including the quality of the devices and the photos generated, as well as Unico's business rules. To avoid issues in your application, do not restrict the size of the string generated by the SDK for these files in your programming logic or infrastructure.
If it is necessary to convert the base64 string to a bitmap, the standard method does not work for Android. You need to perform a split at the comma (,) for it to function correctly. If you want to learn more, read the article:How to convert a Base64 string into a Bitmap image to show it in a ImageView?.
onErrorSelfie
MethodIf an error occurs during image capture, this method returns an ErrorBio
object:
Learn more about ErrorBio
types in the SDK Error Handling section.
If not configured, the SDK will use the environment set in the configuration file (getHostKey
). If getHostKey
is not being used, an error will be returned.
You can configure the environment to be used during SDK execution by using the EnvironmentEnum
enumeration, which contains the following options:
EnvironmentEnum.PROD
: for the Production environment
EnvironmentEnum.UAT
: for the Testing (UAT) environment
See the implementation example below:
To proceed with opening the camera, you must first prepare it using the prepareSelfieCamera
method. This method takes two parameters: the implementation of the SelfieCameraDelegate
class and the JSON with the credentials generated in the previous step.
When the camera is prepared, the onCameraReady
event is triggered, receiving an object of type AcessoBioCameraOpenerDelegate
as a parameter. You should override this method to open the camera using the object received through the open()
method:
The ErrorPrepare
type is an extension of ErrorBio
, containing all of its properties. Learn more about the ErrorBio
type in the SDK error handling section.
If an error occurs while preparing the camera, the onCameraFailed
event is triggered. You should implement this method according to your app's business logic.
After capturing images, the next step is to send the generated encrypted
image from the SDK to the Client APIs.
For security reasons, the interval between the generation of the encrypted data and the sending through one of the available flows must be no more than 10 minutes. Submissions made beyond this period will be automatically rejected by the API.
Still need help?
Didn't find something or still need help? If you're already a client or partner, you can reach out through our Help Center.
In this section, you will find all the necessary information for using and integrating the Unico IDCloud SDK into your iOS applications for document capture
This guide has been designed to help you quickly and easily implement the Android SDK. Below, you'll find the step-by-step process for the complete integration. If you wish to customize the experience further, check out the iOS Customization section.
In this camera mode, there is a capture frame to assist the user in positioning the document correctly. After positioning the document correctly, the user must click the button to capture the photo of the document.
The SDK does not perform any type of validation on what is being captured.
In this camera mode, it is possible to capture the following documents:
RG: Capture of the RG (separate front and back).
CNH: Capture of the CNH opened.
CNH Front: Capture of the front of the CNH.
CNH Back: Capture of the back of the CNH.
CPF: Capture of the CPF document.
Without Silhouette: Capture of a generic document.
To get started with the Unico IDCloud iOS SDK, import the SDK and implement the AcessoBioManagerDelegate
interface in the ViewController
you wish 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 while providing the appropriate context and override the callback methods with the business logic of your application.
Note that, as in the previous example, the implementation work for the AcessoBioManagerDelegate
interface mainly involves configuring the callback methods. Each method is called in a specific situation based on the SDK's return status.
Override the methods exemplified above with your application’s business logic.
onErrorAcessoBioManager(_ error: ErrorBio!)
This method is invoked whenever any implementation error occurs using any SDK method. It receives an ErrorBio
parameter that contains error details. See the Error Handling section for more about ErrorBio
.
onUserClosedCameraManually()
This method is invoked when the user manually closes the camera, such as by clicking the "Back" button.
onSystemClosedCameraTimeoutSession()
This method is invoked when the maximum session time is reached (without capturing an image).
You can configure the session timeout in seconds using setTimeoutSession
. The default and minimum timeout is 40 seconds.
onSystemChangedTypeCameraTimeoutFaceInference()
This method is invoked when the maximum time for face detection is reached without detection.
The maximum time is 13 seconds. The mode is then switched to manual capture to facilitate the user’s action.
All the above methods must be created as indicated in your project (even without any logic); otherwise, the project won’t compile successfully.
The method to open the camera (which is called in the next step) needs to know what to do when an image is successfully captured or if there is an error in the process. You specify "what to do" to the camera opening method through the configuration of delegates that are invoked in success or error situations.
By configuring the delegates, you can define the behavior of your app in case of an error (using the onErrorDocument
method) or success (using the onSuccessDocument
method) during image capture.
To set up the delegates, you should implement the DocumentCameraDelegate
and AcessoBioDocumentDelegate
interfaces:
onSucessDocument
MethodWhen successfully capturing an image, this method is invoked and returns an object of type ResultCamera
, which is used later in the REST API requests:
The ResultCamera
object returns two attributes: base64
and encrypted
.
The base64
attribute can be used if you want to display a preview of the image in your app.
Both the encrypted
and base64
attributes can be sent in the REST API calls of the by Client.
onErrorDocument
If an error occurs during the image capture, this method is invoked and returns an object of type ErrorBio
:
Learn more about the types of ErrorBio
in the SDK's error handling section.
To open the camera, it is necessary to prepare it using the prepareDocumentCamera
method. This method takes as parameters the implementation of the DocumentCameraDelegate
class and the JSON with the credentials, generated in the previous step.
When the camera is ready, the onCameraReadyDocument
event is triggered, which receives a parameter of type AcessoBioCameraOpenerDelegate
. You should override this method to open the camera using the object received through the openDocument()
method, receiving the parameters for the type of document to be captured, which are:
If you need to capture a document for which there is no specific frame (e.g., RNE, among others), use the DocumentEnums.none
frame, which will allow you to use a generic rectangular frame to guide any capture.
The delegates implemented above (described here as Self):
The ErrorPrepare
type is an extension of ErrorBio
, thus containing all its properties. Learn more about the ErrorBio
type in the error handling section of the SDK.
If an error occurs while preparing the camera, the onCameraFailedDocument
event is triggered. You should implement this method according to your app's business logic. In case of success, the onSuccessDocument
event is triggered, as explained in the section above.
After capturing images, the next step is to send the generated base64
image from the SDK to the Client APIs.
If it is necessary to convert the base64 string to a bitmap, the standard method does not work for Android. You need to perform a split at the comma (,) for it to function correctly. If you want to learn more, read the article:.
Parameter | Description |
---|
Still need help?
Didn't find something or still need help? If you're already a client or partner, you can reach out through our .
| Capture the front of the CPF |
| Capture the open CNH |
| Capture the front of the CNH |
| Capture the back of the CNH |
| Capture the open RG |
| Capture the front of the RG |
| Capture the back of the RGo RG |
| Capture any other document |