Quick start
Quick start guide for the DocIDV iOS SDK.
Starting the SDK
Here is an example of how to launch the SDK from your host app:
func startDocIDV() async {
do {
try await IDnowDocIDV.shared.start(token: token,
isRoutedSession: isRoutedSession,
preferredLanguage: preferredLanguage,
viewController: viewController,
bindingKey: bindingKey)
// Handle success
} catch let error {
// Handle errors
}
}
This code calls the main start method to launch the DocIDV library. It takes several parameters:
| Parameter | Type | Description |
|---|---|---|
| token | String | The identification token provided for the session. |
| isRoutedSession | Bool | Boolean which can be set by customers to allow resuming an ident that was started from another side. |
| preferredLanguage | String | The preferred language code for the SDK, e.g., "fr". Defaults to English ("en") if not specified. |
| viewController | UIViewController | The view controller that will present the SDK. It is also used to determine the appearance mode (light/dark) from your app. |
| bindingKey | String | Used for device binding use cases. It helps establish a correlation between a user's verified identity and their mobile device. This is particularly useful for device authentication and re-authentication scenarios. The bindingKey for a completed identification can be fetched via an API endpoint and compared with the one used during SDK initialization. |
Handling errors
In case of an error, the start method will throw the error. The error is an IDnowDocIDVError. Here is an enum describing each case:
public enum IDnowDocIDVError: Error {
case cancelled(reason: AbortReason, message: String)
case token(error: TokenError, message: String)
case network(error: NetworkError, message: String)
case internalError(code: Int, message: String)
}
Handling Specific Errors
Token errors
public enum TokenError {
case formatError
case notFound
case expiredOrDeleted
case alreadyCompleted
case viToken
}
- For
expiredOrDeleted, it is recommended to request a new identification token and restart the process. - For
alreadyCompleted, it is recommended to inform the user that they have already submitted all required information and should wait for the final result.
Other errors
- For all other error codes, it is recommended to show a generic error message and ask the user to try restarting the process.