Current version
The latest iOS Liveness SDK compat version is 0.1.7. It supports iOS 12 and below, so it also covers older integrations.Prerequisites
- iOS minimum deployment target: iOS 12.0
- Camera permission declared (
NSCameraUsageDescriptioninInfo.plist) - Swift 6.1 (set in the pod’s
swift_versions)
Step 1 — Add the SDK
- CocoaPods
- Swift Package Manager
Add the pod to your Then run:
Podfile:Step 2 — Declare the camera permission
Add the following key to yourInfo.plist:
Step 3 — Generate tokens server-side
Before initializing the SDK your backend must generate a session ID and a liveness token. Use theApiClient helper below as a reference for the required calls.
Generate session ID — POST /v2/api/identity/sdk/session/generate:
POST /v2/api/identity/sdk/liveness/token:
Step 4 — Initialize and launch the SDK
1
Import the package
2
Initialize the SDK with tokens
3
Start the liveness task
4
Add the liveness view controller
5
Handle the close delegate
Available liveness tasks
All tasks accept a
difficulty parameter (.easy, .medium, .hard) and an optional timeout in milliseconds.
Configuration options
Callback data (LivenessData)
Present only on failure. Contains
key (e.g. eyes_closed, image_capture_failed, invalid_or_expired_session) and message.iOS (Compat) version
The compat version of the SDK is for integrations requiring support for iOS 12 and below or legacy codebases. The current version is 0.1.7. Install it via CocoaPods:import YouverifyLivenessSDK, because that is the module name.
The pod excludes the
arm64 architecture for the iOS Simulator. On an Apple silicon Mac, run the simulator with Rosetta or test on a physical device.If you receive an
invalid_or_expired_session error, your session ID has expired. Generate a new sessionId and sessionToken from your backend and call initializeSDK again with the fresh values.