Skip to main content

Configuring Privacy Settings for Camera and Photo Library Access

To use the UAEKYC Framework, your app must request access to the device’s camera and photo library. These permissions can be configured directly in Xcode.

Step 1: Open the Target Settings

  1. In Xcode, select your project in the Project Navigator.
  2. Select the target of your app from the list.
  3. Navigate to the Info tab in the target settings.

Step 2: Add Privacy Descriptions

  1. Scroll down to the Custom iOS Target Properties section.
  2. Click the + button to add a new property.
  3. Add the following keys and their corresponding descriptions:

Camera Access

  • Key: Privacy - Camera Usage Description
  • Value: This app requires access to the camera for capturing documents and images for identity verification.

Photo Library Access

  • Key: Privacy - Photo Library Usage Description
  • Value: This app requires access to the photo library for selecting images for identity verification.

JourneyResult

JourneyResult is a class representing different possible results of a KYC journey.

Properties

  • error: SDKError? Represents an error encountered during the journey, if applicable.
  • status: JourneyResultStatus Indicates the final status of the journey.

JourneyResultStatus

JourneyResultStatus is an enumeration representing the different statuses a JourneyResult can have.

Possible Values

  • success (0): Represents a successful journey.
  • documentVerificationFailed (1): Indicates that the document verification process was unsuccessful, usually due to incorrect or poor-quality documents.
  • icpVerificationFailed (2): Indicates that the ICP verification process failed.
  • cancelled (3): Indicates that the journey was cancelled by the user.
  • sessionExpired (4): Indicates that the session timed out before the user completed the journey.
  • error (5): Represents a failure due to an internal error. The error details can be retrieved via the error property of the parent class.
  • blocked (6): Indicates that the journey is blocked due to multiple failed verification attempts. See Journey Blocking Mechanism.

SDKError

SDKError is a class representing errors that may occur during the journey.

Properties

  • type: SDKErrorType Specifies the type of error.
  • code: Int Represents an error code for identifying the specific issue. This is particularly relevant for internalError type.
  • reason: String? Provides additional details about the error, if available.
  • timeRemaining: Int Time remaining in seconds until the journey can be attempted again. This is relevant for journeyBlocked error type.

Error Description

A localized error message can be retrieved via the errorDescription property.

SDKErrorType

SDKErrorType is an enumeration representing different types of errors that can occur.

Possible Values

  • notInitialized (0): The SDK was not initialized before calling startJourney.
  • tokenExpired (1): The provided journey token has expired.
  • configError (2): The journey configuration is invalid. The reason for this error can be accessed via the reason property, which is guaranteed to be not-null in this context.
  • internalError (3): An internal SDK error occurred. The error code can be accessed with the code property, and an optional reason via the reason property.
  • journeyBlocked (4): The journey is blocked due to multiple failed verification attempts. The timeRemaining property indicates how long the user must wait. See Journey Blocking Mechanism.

Internal Error Codes

When type is internalError, the code property contains one of the following values:
Error CodeDescription
1Journey API initialization failed
2Journey API UUID conversion failed
3Journey handshake failed
4Journey initialization failed
5Journey set consent failed
6Journey document info set failed
7UI image to raw conversion failed
8Journey front document upload failed
9Journey back document upload failed
10Journey document check failed
11Journey face upload failed
12Journey complete call failed
13Journey one-to-many config failed
14Journey one-to-many upload face failed
15Journey one-to-many verification failed
16Journey one-to-many Emirates ID failed
17NFC verification failed
18NFC failure notification failed

Example Code for UAEKYC Framework Integration

Below is an example of how to integrate and use the UAEKYCFramework in a SwiftUI application.

Code Implementation

@main
struct MainApp: App {
    init() {
        do {
            let domain = "your.domain.ae"

            // Initialize SDK
            try UAEKYCSDK.initSDK(
                domain: domain
            )
        } catch let error as SDKError {
            fatalError(error.localizedDescription)
        } catch {
            fatalError("Unknown error occurred while initializing sdk : \(error.localizedDescription)")
        }
    }

    var body: some Scene {
        WindowGroup {
            Button(action: startJourney) {
                Text("Start journey")
            }
        }
    }

    func startJourney() {
        let config: JourneyConfig

        do {
            try JourneyConfig.Builder()
                .setAccentColor(UIColor(red: 1, green: 0, blue: 0, alpha: 1))
                .setJourneyToken("<JOURNEY-TOKEN>")
                .setLogo(UIImage(systemName: "globe")!)
                .setPrivacyPolicyLink("https://example.com")
                .setTheme(.system)
                .setLanguage(.english)
                .build()
        } catch let error as SDKError {
            print(error.localizedDescription)
            return
        } catch {
            print("Unknown error occurred building journey config : \(error.localizedDescription)")
            return
        }

        do {
            try UAEKYCSDK.startJourney(config: config) { result in
                handleJourneyResult(result: result)
            }
        } catch let error as SDKError {
            print(error.localizedDescription)
            return
        } catch {
            print("Unknown error occurred while starting journey : \(error.localizedDescription)")
            return
        }
    }

    private func handleJourneyResult(result: JourneyResult) {
        switch result.status {
        case .success:
            print("Successfully verified")
        case .documentVerificationFailed:
            print("Document verification failed")
        case .icpVerificationFailed:
            print("ICP verification failed")
        case .cancelled:
            print("Journey cancelled by user")
        case .sessionExpired:
            print("Session expired")
        case .blocked:
            print("Journey blocked")
        case .error:
            print(result.error!.localizedDescription)
        @unknown default:
            print("Unknown journey result!")
        }
    }
}

Objective-C Compatibility

  • The public API’s of the UAEKYC Framework is fully compatible with Objective-C and can be used just like the Swift implementation.
  • You will have to import the generated header <UAEKYCFramework/UAEKYCFramework-Swift.h> for using the API’s in Objective-C.

Troubleshooting

  • Ensure you replace <JOURNEY-TOKEN> with the actual journey token, and also make sure that it is valid for the current session.
  • Check the SDK initialization error logs for more details if the setup fails.

Camera Opens in PiP Mode (WebView Only)

If you are loading the UAE KYC SDK inside a WKWebView, the camera may open in Picture-in-Picture (PiP) mode instead of rendering inline. This happens because allowsInlineMediaPlayback is disabled by default in WKWebView. Set it to true on your WKWebViewConfiguration before creating the WebView:
let config = WKWebViewConfiguration()
config.allowsInlineMediaPlayback = true

let webView = WKWebView(frame: .zero, configuration: config)
For Cordova apps, add the following preference to your config.xml. See Cordova iOS Configuration for more details.
<preference name="AllowInlineMediaPlayback" value="true" />
This setting must be applied before the WebView is created — it cannot be changed at runtime.