iOS SDK Initial Integration Guide

Use this guide to integrate the UR Code Scan+Match iOS SDK into Your App.

Other Device SDKs Integration Guides:


Prerequisite

Download and Install Xcode.

Embed FaceTecURScanMatchSDK.xcframework into Your App

  1. Open Xcode Studio. Go to File → New → Project → App (iOS). Fill out the project options and choose "Interface: Storyboard" and "Language: Swift".
  2. Download and extract the FaceTec iOS UR Scan+Match SDK. Drag the FaceTecURScanMatchSDK.xcframework folder into Your App in Xcode.
  3. In the left bar under Targets, choose "General" and scroll down to Frameworks, Libraries, and Embedded Content. Select "Embed & Sign" for the FaceTecURScanMatchSDK.xcframework.
  4. Open the Info.plist file and add the new entry “Privacy - Camera Usage Description” with type String and value “UR Codes Scan + Match by FaceTec”.
  5. In ViewController.swift, import FaceTecURScanMatchSDK.

Import Default Config and Run

  1. Open the FaceTec UR Scan + Match Sample App and copy the config.swift file over to Your App. Remove anything that causes a compile error.
  2. Ensure your App’s Bundle Identifier has the same value as the “appId” listed in the Config.LICENSE_TEXT.
  3. Update ViewController to conform to the FaceTecURScanMatchSDK protocols.
    class ViewController: UIViewController, FaceTecURScanMatchSDKInitializeCallback, FaceTecURScanMatchSessionDelegate {
  4. Copy onURScanMatchSDKInitializeSuccess, onURScanMatchSDKInitializeError, onComplete from URCodesSampleViewController.swift into Your View Controller to conform to FaceTecURScanMatchSDK protocols. Remove the function contents as shown below:
    func onURScanMatchSDKInitializeSuccess(sdkInstance: FaceTecURScanMatchSDKInstance) {
            self.sdkInstance = sdkInstance
        }
        
        func onURScanMatchSDKInitializeError(error: FaceTecURScanMatchInitializationError) {
            
        }
        
        func onComplete(_ status: FaceTecURScanMatchSessionStatus) {
            
        }
  5. Go to Main.storyboard. Add a UIButton to the center of the screen and link it to the View Controller as an IBAction.
  6. Copy var sdkInstance: FaceTecURScanMatchSDKInstance? from the URCodesSampleViewController.swift into Your View Controller.
  7. Copy FaceTecURScanMatchSDK.initialize(licenseText: Config.LICENSE_TEXT, completion: self) from URCodesSampleViewController.swift into Your View Controller viewDidLoad().
        override func viewDidLoad() {
            super.viewDidLoad()
    
            FaceTecURScanMatchSDK.initialize(licenseText: Config.LICENSE_TEXT, completion: self)
        }
  8. In your onURScanMatchSDKInitializeSuccess, add self.sdkInstance = sdkInstance.
        override func viewDidLoad() {
            super.viewDidLoad()
    
            FaceTecURScanMatchSDK.initialize(licenseText: Config.LICENSE_TEXT, completion: self)
        }
  9. In Your Button’s IBAction, add:
     @IBAction func onButtonPressed(_ sender: Any) {
            let vc = self.sdkInstance!.startURCodeMatch(self)
            self.present(vc, animated: true, completion: nil)
        }
  10. On success, Your App is ready to build and run!

Network Security

Although the UR Scan+Match SDK provides various layers of security, Network Protections can only be configured at the Application Level. Apple's Preventing Insecure Network Connections Guide provides comprehensive documentation on how to secure Your Application's Network Traffic.

In particular, FaceTec recommends that Your Team implement Certificate Pinning to prevent Man-in-the-Middle Attacks.