Skip to content

Initial setup of LUNA ID for iOS#

This topic describes how to perform an initial setup of LUNA ID to start using it in your iOS projects.

Step 1. Add XCFrameworks#

To embed XCFrameworks into your app:

1․ Drag and drop the following .xcframework files from the LUNA ID installation package to the Frameworks, Libraries, and Embedded Content section of Xcode:

  • flower.xcframework
    File location: luna-id-sdk_ios_v.X.X.X\build\Release-iphoneos\frameworks\flower.framework\
  • fsdk.xcframework
    File location: luna-id-sdk_ios_v.X.X.X\build\Release-iphoneos\frameworks\fsdk.framework\
  • LunaCamera.xcframework
    File location: luna-id-sdk_ios_v.X.X.X\build\Release-iphoneos\frameworks\LunaCamera.framework\
  • LunaCore.xcframework
    File location: luna-id-sdk_ios_v.X.X.X\build\Release-iphoneos\frameworks\LunaCore.framework\
  • LunaWeb.xcframework
    File location: luna-id-sdk_ios_v.X.X.X\build\Release-iphoneos\frameworks\LunaWeb.framework\
  • tsdk.xcframework
    File location: luna-id-sdk_ios_v.X.X.X\build\Release-iphoneos\frameworks\tsdk.framework\

2․ Make sure that all the files have the Embed label so that they will be bundled with your final app. Otherwise, your app will crash at start.

Step 2. Enable OneShotLiveness estimation#

To enable OneShotLiveness estimation, specify the the following parameters in the LCLunaConfiguration object at the app start:

Parameter Description
identifyHandlerID Specifies the ID of a handler that receives the best shot and identification according to the existing list of faces.
registrationHandlerID Specifies the ID of a handler that registers a new user and receives the best shot and user name.
verifyID Specifies the ID of a verifier used to roll out LUNA PLATFORM 5.
lunaAccountID Specifies the "account_id" generated after creating the LUNA PLATFORM 5 account for authorization by the "Luna-Account-Id" header.
lunaServerURL Specifies the LUNA PLATFORM 5 host URL. The URL should not have the slash at the end. For example: https://LUNA_PLATFORM_HOST/6.

For example:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {        
...        
        let configuration = LCLunaConfiguration.defaultConfig()
        configuration.identifyHandlerID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
        configuration.registrationHandlerID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
        configuration.verifyID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
        configuration.lunaAccountID = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
        configuration.lunaServerURL = URL(string: "https://LUNA_PLATFORM_HOST/6")
...
        return true
    }

Step 3. Specify license data#

Specify license data in the "vllicense.plist" file. For details, see Licensing.

Step 4. Create a face recognition screen in your app#

To create a face recognition screen on which the video stream from the camera is displayed:

1․ Add the LMCameraBuilder.viewController() method in the required part of your app.

2․ Specify the LCLunaConfiguration object as an input parameter. It allows you to set various threshold values that affect the resulting recognition screen.

You can also set up a delay, in seconds, to define when the face recognition will start after the camera is displayed in the screen. To do this, use LCLunaConfiguration.startDelay.