Add our library to your iOS app
Learn how to add our biometric authentication library to your iOS or Android app so you can test biometric authentication during your manual and automated test sessions.
Add KobitonLAContext.framework
First you’ll add KobitonLAContext.framework
as an embedded and signed framework in your app’s Xcode project.
-
Launch Xcode and select your project.
-
Download and unzip
KobitonLAContext.zip
. -
Move
KobitonLAContext.framework
into the project directory. -
In Xcode, scroll down to Frameworks, Libraries, and Embedded Content and select the + icon.
-
Select Add Other…, Add Files…, and choose
KobitonLAContext.framework
. -
Select Embed & Sign.
Modify ViewController.swift
Next you’ll open the ViewController. swift file in your project directory and replace all LocalAuthentication
imports with KobitonLAContext
.
Then replace all context = LAContext()
variables with context = KobitonLAContext()
.
import UIKit
import LocalAuthentication /// Change to import KobitonLAContext
class ViewController: UIViewController {
var context = LAContext() /// Change to var = KobitonLAContext()
enum AuthenticationState {
case loggedin, loggedout
}
Save the file. If your app requires support for iOS 14 or earlier, you’ll also need to add a few info.plist
parameters. Otherwise, you can verify your changes.
Add new info.plist parameters
If your app requires support for iOS 14 or earlier, you’ll also need to add a few info.plist
parameters. These let you …
-
Open the project’s root directory and select Info.
-
Next to any of the custom iOS target properties, select the + icon, and choose App Transport Security Settings to add this property to the list.
-
Next to your new property, select the dropdown, then the + icon, then choose Allow Arbitrary Loads.
-
Set Allow Arbitrary Loads to Yes.
-
Your changes are saved automatically. When you’re finished, verify your changes.
Verify your changes
First, rebuild your .ipa
and upload it to the app repository. Then, start a manual test session, launch your app, and try using biometric authentication to sign in. Select Pass and check the logs to see verify your changes.