> ## Documentation Index
> Fetch the complete documentation index at: https://docs.checkin.com/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS SDK

> Add identity verification to your iOS app.

## Requirements

| | Minimum |
| - | - |
| iOS | 16.0 |
| Xcode | 16.3 |
| Swift | 5.7 |

This guide covers SDK version 4.2.3. NFC chip reading needs 4.1.1 or newer.

## Install

Add the SDK with CocoaPods, Carthage or Swift Package Manager:

```ruby Podfile theme={null}
pod 'GetID', podspec: 'https://cdn.getid.cloud/sdk/ios/4.2.3/GetID.podspec'
```

```text Cartfile theme={null}
github "vvorld/getid-ios-sdk" ~> 4.2.3
```

```swift Package.swift theme={null}
.package(url: "https://github.com/vvorld/getid-ios-sdk", from: "4.2.3")
```

With Swift Package Manager in Xcode, choose **File → Add Package Dependencies**, enter `https://github.com/vvorld/getid-ios-sdk`, and set the version to 4.2.3 or above.

If you hit build issues, disable **User Script Sandboxing** in build settings. Objective-C apps must set **Always Embed Swift Standard Libraries** to `YES`.

### Info.plist

| Key | When |
| - | - |
| `NSCameraUsageDescription` | Always |
| `UIDesignRequiresCompatibility` = `true` | On iOS 26: the SDK doesn't support Liquid Glass yet |
| NFC keys | If the flow uses NFC. See [NFC](#nfc). |

## NFC

Only needed if the flow uses NFC.

1. **Enable NFC in the Apple Developer portal.** Under **Certificates, Identifiers & Profiles → Identifiers**, select your App Identifier and turn on **NFC Tag Reading**.
2. **Add the capability in Xcode.** In your app target, open **Signing & Capabilities**, click **+ Capability** and add **Near Field Communication Tag Reading**.
3. **Enable the PACE and TAG formats** in your target's `.entitlements` file:
   ```xml Entitlements theme={null}
   <key>com.apple.developer.nfc.readersession.formats</key>
   <array>
     <string>PACE</string>
     <string>TAG</string>
   </array>
   ```
4. **Add the usage description** to `Info.plist`, with a text the applicant sees:
   ```xml Info.plist theme={null}
   <key>NFCReaderUsageDescription</key>
   <string>This app uses NFC to read your identity document.</string>
   ```
5. **Add the ISO 7816 select identifiers** to `Info.plist`: `A0000002471001` for passports and `A00000045645444C2D3031` for ID cards and driving licences.
   ```xml Info.plist theme={null}
   <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
   <array>
     <string>A0000002471001</string>
     <string>A00000045645444C2D3031</string>
   </array>
   ```

The NFC step is enabled per flow in the Backoffice: **Flows → \[flow name] → Customize → NFC**. NFC needs a physical device.

See [NFC chip reading](https://docs.checkin.com/products/nfc.md).

## Start the flow

Call `startVerificationFlow` from a user action, such as a button handler.

```swift Swift theme={null}
import GetID

GetIDSDK.delegate = self

GetIDSDK.startVerificationFlow(
  apiUrl: "API_URL",
  auth: .jwt("JWT"),
  flowName: "FLOW_NAME"
)
```

## Options

<table>
  <colgroup>
    <col width="209" />

    <col width="150" />

    <col width="325" />
  </colgroup>

  <thead>
    <tr>
      <th>Option</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>**`apiUrl`** required</td>
      <td>`String`</td>
      <td>Environment URL, for example `https://partner.sb.getid.dev` or `https://partner.getid.ee`</td>
    </tr>

    <tr>
      <td>**`auth`** required</td>
      <td>`.jwt` or `.sdkKey`</td>
      <td>`.jwt("JWT")` with a session token from `POST /sdk/v2/token`. During development, `.sdkKey("SDK_KEY")` works instead; don't ship the SDK key in production apps. `.sdkKey` also takes an optional customer ID: `.sdkKey("SDK_KEY", customerId: "CUSTOMER_ID")`.</td>
    </tr>

    <tr>
      <td>**`flowName`** required</td>
      <td>`String`</td>
      <td>Flow name from the Backoffice</td>
    </tr>

    <tr>
      <td>**`locale`**</td>
      <td>`String`</td>
      <td>Language code, for example `en`, `de` or `ar_SA`. Overrides the device language. See [Localization](https://docs.checkin.com/integrate/localization.md#supported-languages) for all codes.</td>
    </tr>

    <tr>
      <td>**`dictionary`**</td>
      <td>`String`</td>
      <td>Name of a custom translation dictionary. See [Localization](https://docs.checkin.com/integrate/localization.md#custom-translations).</td>
    </tr>

    <tr>
      <td>**`metadata`**</td>
      <td>`GetIDMetadata`</td>
      <td>`externalId`: your customer or session ID, not unique. `labels`: up to 30 string key-value pairs.</td>
    </tr>

    <tr>
      <td>**`profileData`**</td>
      <td>`[String: String]`</td>
      <td>Known applicant data as key-value pairs, for example `first-name`, for cross-checking and prefilling. See [Profile data keys](#profile-data-keys).</td>
    </tr>

    <tr>
      <td>**`address`**</td>
      <td>`GetIDAddress`</td>
      <td>Expected address for [Proof of Address](https://docs.checkin.com/products/proof-of-address.md): `country` (ISO alpha-3), `city`, `postcode`, `addressLine`, `streetName`, `houseNumber`.</td>
    </tr>

    <tr>
      <td>**`acceptableDocuments`**</td>
      <td>`[GetIDAcceptableDocuments.Country: [GetIDDocumentType]]`</td>
      <td>Narrows the flow's accepted documents for this session. Maps ISO alpha-3 country codes to document types, for example `.passport` and `.idCard`, with a `.default` key. See [Accepted documents per session](https://docs.checkin.com/integrate/applicant-data.md#accepted-documents-per-session).</td>
    </tr>
  </tbody>
</table>

Pass `profileData` and `acceptableDocuments` with `.init(...)`, as in the [full example](#full-example).

### Profile data keys

`profileData` keys match field types in the flow, for example `first-name`. If the flow has a Profile Data step with a field of the same type, the value prefills that field.

Supported keys:

`first-name`, `last-name`, `date-of-birth`, `gender`, `nationality`, `personal-number`, `document-number`, `date-of-issue`, `date-of-expiry`, `email`, `phone-number`, `address`, `postcode`, `city-of-residence`, `country-of-residence`.

Dates are `YYYY-MM-DD`, `gender` is `male` or `female`, and countries are ISO alpha-3.

## Callbacks

Set `GetIDSDK.delegate` and conform to `GetIDSDKDelegate`.

<table>
  <colgroup>
    <col width="222" />

    <col width="182" />

    <col width="325" />
  </colgroup>

  <thead>
    <tr>
      <th>Callback</th>
      <th>Receives</th>
      <th>Called when</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>**`verificationFlowStart`**</td>
      <td>Nothing</td>
      <td>The flow has started</td>
    </tr>

    <tr>
      <td>**`verificationFlowDidComplete`**</td>
      <td>`GetIDApplication` with `applicationId`</td>
      <td>The applicant has submitted everything</td>
    </tr>

    <tr>
      <td>**`verificationFlowDidCancel`**</td>
      <td>Nothing</td>
      <td>The applicant cancelled the flow</td>
    </tr>

    <tr>
      <td>**`verificationFlowDidFail`**</td>
      <td>`GetIDError`</td>
      <td>The flow can't continue. See [Errors](#errors).</td>
    </tr>
  </tbody>
</table>

The SDK doesn't return verification results. Get them on your server by [webhook](https://docs.checkin.com/integrate/results/webhooks.md) or [API](https://docs.checkin.com/integrate/results/retrieve-results.md).

## Errors

`verificationFlowDidFail` receives `GetIDError.initializationError` before any SDK screen is shown, or `GetIDError.flowError` after the SDK has closed its UI. Read `error.localizedDescription` when logging.

### `GetIDError.InitializationError`

| Case | Meaning | Recover |
| - | - | - |
| `invalidURL` | `apiUrl` is not a URL, or it is a file URL. | Pass the environment URL, for example `https://partner.getid.ee`. |
| `invalidFlowName` | `flowName` is empty or only whitespace. | Pass the flow name from the Backoffice. |
| `invalidKey` | `.sdkKey` was rejected (HTTP 401) while requesting a token. | Use the SDK key from the Backoffice, not the API key. In production, use `.jwt` and keep the SDK key on your server. |
| `invalidToken` | The JWT was rejected (HTTP 401) while loading the flow, for example because it has expired. | Request a new JWT from your backend and start again. |
| `flowNotFound` | This environment has no flow with that name (HTTP 404). | Use the exact name from the Flows tab, or create the flow. |
| `unsupportedSchemaVersion(version:supportedVersions:)` | This environment does not support the SDK's API schema. `version` is the schema this SDK speaks (currently `2.1.0`). `supportedVersions` is what the server accepts. This is not the SDK release number (`4.2.3`). | Update the SDK. If it still fails, `apiUrl` points at an environment that does not support this SDK. Contact [support](https://docs.checkin.com/get-started/support.md) with both values. |
| `applicationWithThisCustomerIdAlreadyExists` | `.sdkKey(_, customerId:)` was rejected (HTTP 422) because that `customerId` already has an application. | Start again with a new `customerId`, or omit it. |
| `unexpectedError(underlyingError: .failedToFindViewControllerToPresentFrom)` | There is no view controller to present from. | Call `startVerificationFlow` after the app has a visible window and root view controller. |
| `unexpectedError(underlyingError: .failedToReceiveToken(...))` or `.failedToReceiveConfiguration(...)` | The start request failed for another reason: network, HTTP 5xx, or a response the SDK could not read. | Retry. Confirm the device can reach `apiUrl`. |

### `GetIDError.FlowError`

| Case | Meaning | Recover |
| - | - | - |
| `tokenExpired` | Submitting the application was unauthorized. The JWT is invalid or has expired. | Issue a new JWT and start the flow again. The applicant repeats the flow. |
| `noPermission(.camera)` | The applicant denied camera access and opened Settings from the SDK. The flow then closes. | Ask them to allow Camera in Settings, then start again. `NSCameraUsageDescription` must be set. |
| `applicationWithThisCustomerIdAlreadyExists` | Submitting the application was rejected (HTTP 422) because this customer ID already has an application. | Do not retry with the same customer ID. Start a new verification with a new customer ID or a new JWT. |
| `failedToSendApplication(underlyingError:)` | The application was not accepted. `underlyingError.localizedDescription` is `Bad format of the application.`, `Request failed: …`, or `HTTP error: …`. | For a network failure or HTTP 5xx, retry on a stable connection. For bad format, retry once, then contact [support](https://docs.checkin.com/get-started/support.md) with that description. There is no `applicationId` until `verificationFlowDidComplete`. |

## Full example

```swift Swift theme={null}
import GetID
import UIKit

final class VerificationViewController: UIViewController {
    func startVerification(sessionToken: String) {
        let profileData = [
            "first-name": "Alex",
            "last-name": "Example",
            "date-of-birth": "1990-01-20"
        ]
        let address = GetIDAddress(
            country: "EST",
            city: "Tallinn",
            postcode: "10123",
            addressLine: "Harju 1",
            streetName: nil,
            houseNumber: nil
        )
        let acceptableDocuments: [GetIDAcceptableDocuments.Country: [GetIDDocumentType]] = [
            "EST": [.passport, .idCard],
            .default: [.passport]
        ]
        let metadata = GetIDMetadata(
            externalId: "customer-123",
            labels: ["journey": "account-opening"]
        )

        GetIDSDK.delegate = self

        GetIDSDK.startVerificationFlow(
            apiUrl: "https://partner.sb.getid.dev",
            auth: .jwt(sessionToken),
            flowName: "ID-Selfie-Liveness",
            profileData: .init(profileData),
            address: address,
            acceptableDocuments: .init(acceptableDocuments),
            metadata: metadata,
            locale: "en",
            dictionary: "my-dictionary"
        )
    }
}

extension VerificationViewController: GetIDSDKDelegate {
    func verificationFlowStart() {}

    func verificationFlowDidComplete(_ application: GetIDApplication) {
        notifyBackend(application.applicationId)
    }

    func verificationFlowDidCancel() {
        goBack()
    }

    func verificationFlowDidFail(_ error: GetIDError) {
        showError(error.localizedDescription)
    }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.