Skip to main content
In this guide, you will learn how to:
  • Include the SDK in your iOS apps.
  • Get a visitorId.
  • Read the SDK response.
  • Enable location data collection (optional; to start getting additional location-based proximity data).
  • Configure the SDK as per your needs.
  • Specify additional metadata in your identification request.
  • Handle errors.
For a complete example of how to use this SDK in your app, please visit the GitHub repo of our demo app. View our iOS quickstart for a step-by-step guide to get started.

Prerequisites

  1. Sign up for an account with Fingerprint to get your API key.
  2. Xcode 15.0 or higher. See App Store submission requirements for more information.

Including the SDK in your app

Add the SDK as a dependency:
SPM
CocoaPods

Getting a visitorId

To get a visitorId, you need the public API key that you obtained when signing up for an account with Fingerprint. You can find this API key in the Dashboard > API Keys. Here is an example that shows you how to get a visitorId:

Specifying a custom timeout

Default timeout value: 60 seconds You can override the default timeout with a custom value of your choice. If the getVisitorId() call does not complete within the specified (or default) timeout, you will receive a FPJSError.clientTimeout error. Here is an example that shows you how to specify a custom timeout:
Swift

Reading the response

The function FingerprintClientProviding.getVisitorIdResponse() returns the response in a FingerprintResponse object.
Swift
The FingerprintResponse object has the following fields, some of which can be empty/invalid when Sealed Client Results is enabled for your account.

Using Location Data for Proximity Detection

This is optional. Enable this only if you want to include the additional location-based proximity detection signal in your response.
Starting the iOS SDK v2.10.0+, new property allowUseOfLocationData has been added to the Configuration structure. This allows the Fingerprint client to access device location data when available. By default, it is set to false. To start getting Proximity ID and related data, set this property to true in your SDK configuration. Important note: For the best location precision, we recommend initializing the Fingerprint client as early as possible - ideally during your app startup - and maintaining the same instance throughout the app’s lifecycle.

Handling Location Permissions

Your app is responsible for asking for location permissions. Refer to Apple documentation or check the Fingerprint demo app if you need to implement this flow. If you already have this process set up, skip to the next section. If your app doesn’t currently implement a flow for requesting and managing location permissions, we’ve included a utility to help simplify this process. The LocationPermissionHelper is designed to assist host apps with requesting, observing, and responding to user location permission changes. It leverages a LocationPermissionDelegate to notify the host app whenever the authorization status is updated. This simplifies the integration process without needing to build a full permission handling flow from scratch. Here is an example that shows how to create a location permission helper:
Swift
Make sure to declare location permissions in Info.plist as it is required for App Store submission:
  • NSLocationWhenInUseUsageDescription - required; for general system request when asking for location access.
  • NSLocationTemporaryUsageDescriptionDictionarywith ProximityID purpose key - optional; for general system request when asking for temporary precise location in case the user has a setting that hides accurate location.
  • NSLocationAlwaysAndWhenInUseUsageDescription - optional, only if your app requires checking location in background mode; for general system request when asking to always have access to the user’s location (including background). It will also require UIBackgroundModes to have location in Info.plist to access the user’s location in the background.
  • Request permission in your app’s code
    • Call requestPermission() or requestPrecisePermission() from the SDK, depending on the level of access needed.
    • Or use your own location permission flow.
  • Show rationale UI (optional)
    • You may present your own UI to explain why location is needed.

Configuring the SDK

Using the Configuration object, it is possible to configure the SDK as per your requirements. As of now, the following options are supported:

region

Type: Region. Default value: Region.global Specifies the region where your data will be stored and processed. The selected region must match the one configured when registering your app with Fingerprint.
For custom subdomain or proxy integrations, use the Region.custom(domain:fallback:) enumeration case. This allows you to define:
  • domain - Your primary custom endpoint (e.g., custom subdomain or proxy URL) where requests will be sent.
  • fallback (optional) - A list of alternate endpoints that will be used automatically if requests to the primary domain fail. This helps improve reliability and availability in case of connectivity or routing issues.
Use this option when you have configured a custom subdomain or implemented a proxy integration. See region for more information.

extendedResponseFormat

Type: Bool Default value: false When set to true, in addition to those fields returned by default, the FingerprintResponse object will also contain the following fields:
  • ipAddress - String. The IPv4 address of the device.
  • ipLocation - IPLocation. [This field is deprecated and will not return a result for applications created after January 23rd, 2024. See IP Geolocation for a replacement available in our Smart Signals product.] Indicates the location as deduced from the IP address.
  • firstSeenAt, lastSeenAt - Timestamp. See Visitor Footprint Timestamps.

allowUseOfLocationData

Type: Bool Default value: false This option allows you to enable the location data collection needed to calculate the location-based proximity detection signal.

Specifying linkedId and tag

Like the JavaScript agent, the iOS SDK also supports providing custom metadata with your identification request. To learn more about this capability, please visit Linking and tagging information. Here is an example that shows you how to associate your identification request with an account ID and additional metadata:
Swift
The metadata you want to include may not be available when making the identification request. For such scenarios, you can update that event later when the required metadata becomes available. A typical workflow is explained in Update linked_id and tags on the server.

Handling errors

The SDK provides a FPJSError enumeration that helps you identify the reasons behind an unsuccessful identification request. Here is an example that shows you how to handle errors in your app:
Swift

Data Classes

Configuration

Swift

Error

Swift

IPLocation

Swift

Region

Swift

Timestamp