APBiometricAuthentication
此类提供使用 Apple 提供的 LocalAuthentication 框架轻松使用用户生物特征(触控 ID 或面容 ID)进行身份验证的功能。
用法
选项 1
pod 'APBiometricAuthentication'
选项 2
将 APBiometricAuthentication.swift 文件从项目文件夹拖放到项目中。
只需写下以下代码即可开始身份验证
APBiometricAuthentication.shared.beginBiometricAuthentication { (authenticationSuccessful, errorMessage) in
if authenticationSuccessful {
print("Success")
}
else {
print(errorMessage ?? "Error occurred while authentication")
}
}