Challenge - 5 Problems
Biometric Authentication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate1:30remaining
What happens when biometric authentication succeeds?
In an iOS app using Face ID or Touch ID, what is the typical behavior after successful biometric authentication?
Attempts:
2 left
💡 Hint
Think about what the user expects after confirming their identity.
✗ Incorrect
When biometric authentication succeeds, the app typically grants access to protected content or features, often by navigating to the main or secured screen.
🧠 Conceptual
intermediate1:00remaining
Which framework is used for biometric authentication in iOS?
Which Apple framework provides the APIs to implement Face ID and Touch ID authentication in iOS apps?
Attempts:
2 left
💡 Hint
It starts with 'Local' and deals with device security.
✗ Incorrect
The LocalAuthentication framework provides classes and methods to evaluate biometric authentication policies like Face ID and Touch ID.
📝 Syntax
advanced2:00remaining
What is the correct way to create a LAContext and check if biometric authentication is available?
Given the following Swift code snippet, which option correctly creates a LocalAuthentication context and checks if biometric authentication can be evaluated?
iOS Swift
import LocalAuthentication let context = LAContext() var error: NSError? // Check if biometric authentication is available let canEvaluate = context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error)
Attempts:
2 left
💡 Hint
Check the method signature and parameter types carefully.
✗ Incorrect
The method canEvaluatePolicy requires an UnsafeMutablePointer to an NSError? for the error parameter, so it must be passed as &error. Option A correctly uses this syntax.
❓ lifecycle
advanced1:30remaining
What happens if biometric authentication is interrupted by app going to background?
If the user starts biometric authentication but the app goes to the background (e.g., user presses home button), what is the expected behavior?
Attempts:
2 left
💡 Hint
Think about security and user interaction requirements.
✗ Incorrect
Biometric authentication requires user interaction and cannot continue in the background. If interrupted, it is cancelled and must be restarted when the app is active again.
🔧 Debug
expert2:30remaining
Why does this biometric authentication code always fail with error code -7?
Consider this Swift code snippet for biometric authentication:
import LocalAuthentication
let context = LAContext()
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Access needed") { success, error in
if success {
print("Authenticated")
} else {
print(error?.localizedDescription ?? "Unknown error")
}
}
The error code returned is always -7 (LAError.biometryNotAvailable). What is the most likely cause?
Attempts:
2 left
💡 Hint
Error code -7 means biometry is not available on the device.
✗ Incorrect
Error code -7 (LAError.biometryNotAvailable) means the device either lacks biometric hardware or the user has disabled it in system settings. The code is correct but the device environment prevents biometric use.