Skip to main content
Skip table of contents

Quickstart Sample App

Get started by running the VFace Sample App and review its code alongside the iOS integration guide. Code can be repurposed for your own application.

Sample App (sample-vface)

sample-vface demonstrates Veridium SDK integration and use of VFace. It is intended as a minimal functional example and demonstrates:

  • Licensing

  • SDK initialisation

  • Enrolment and authentication

  • Match and storage customisation

  • Image import / export

WARNING

If your licence is only valid for VFace it will only function with the sample-vface app, not any other Veridium sample app.

Please remove all previous versions of the sample apps before installing updated versions. These apps require a minimum of iOS 9.0 and Xcode 14.0.

This guide does not cover using the simulator due to use of hardware cameras.

Build and Run

To build and run the sample-vface app

  1. Download and extract the VeridiumSDK_iOS_[version].zip package as provided by your Veridium representative. The sample-vface app is located at the root.

  2. Navigate to /sample-vface/ and open veridium-sample-vface.xcworkspace. Xcode will open and and list sample-vface in the project navigator. Expand it to reveal Swift source files.

  3. Clean the project by menu selecting Product->Clean Build Folder and then build the app via Product->Build. This should successfully build the application.

  4. A licence string is required, provided by your Veridium representative. This is an online licence and requires the device to have internet access. Unzip the licence package and open sdk.lic with a text editor [Note: the file is UTF-8 plain text encoded]. Copy the whole licence string.

  5. In Xcode, open VeridiumConstants.swift and paste the licence string where indicated, retaining the quotes, for example:

    CODE
    struct VeridiumConstants{
      static let licence = "Et3bLBrNT4feRrmER0P2AuMMDF"  // your licence will be ~1300 char
    }
  6. Your licence is tied to the app's Bundle identifier. Change the Bundle identifier in the General tab to that agreed with your Veridium salesperson. As supplied, the Bundle identifier is com.veridiumid.sample.vface.

  7. Due to Apple's security policies, it is necessary to alter the signing configuration before the app will run. Select the sample-vface target and switch to the Signing & Capabilities tab. Select the Team for signing. You may use automatic signing, or follow your organisation's recommendations for app signing.

  8. Connect an iOS device via USB and select it as the active device in the scheme. Uninstall previous versions of the app from the device and hit Run.

App Features

The app has the typical structure of an iOS app; an AppDelegate.swift, a home screen storyboard Main.storyboard, and home screen view controller ViewController.swift.

The Veridium SDK is initialised asynchronously within viewDidLoad(). Note where the VFace enroler and authenticator objects are registered for use:

CODE
VeridiumSDK.shared.registerLicenseLoader(VeridiumBiometricsVFaceLicenseLoader())
VeridiumSDK.shared.registerDefaultVFaceEnroller()
VeridiumSDK.shared.registerDefaultVFaceAuthenticator()

The app uses the default local storage, and registers a local account in initAccount().

onButtonEnrol() fetches the shared VFace enroller and configures liveness options. enroll is then called with a completion callback for processing the enrolment template and result.

onButtonAuth() fetches the shared VFace authenticator, configures it with a local matching strategy, and configures liveness options. authenticate is then called with a completion callback for processing the result.

Examples are given for these specific use cases:

  • SDK Initialisation, see override func viewDidLoad()

  • Generating VFace templates from images, see func templateWithImage(_ image: CGImage)

  • Authentication using an image as enrolment, see func authWithImage(_ image: CGImage)

  • Image export, see func vfaceExport()

  • Accessing authentication templates, see func onButtonAuth(_ sender: Any). Create a custom matching strategy using the provided CustomMatchingStrategy.swift:

CODE
let matchingStrategy = CustomMatchingStrategy()
authenticator.configure(matchingStrategy)

Troubleshooting

License Troubleshooting

  • The provided licence is for specific features. Ensure you are running the correct app, sample-vface.

  • Ensure your licence string copied correctly without introducing new lines. Your text editor should open the the licence file as UTF-8.

  • Double check the Bundle identifier matches that indicated by your Veridium salesperson.

  • Ensure the device has internet access.

  • Uninstall the app, clean, build, and re-install.

  • In Xcode, open the output console and copy the whole contents and send to your Veridium salesperson.

  • Screenshot where you're entering your licence and send to your Veridium salesperson.

  • We are always happy to take a call to resolve sample app build issues.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.