我知道,LocalAuthentication
在iOS应用中嵌入TouchID很容易.
但是有可能获得TouchID信息并将其与其他指纹数据库进行比较吗?
所以我一直在搜索stackoverflow,我无法找到答案.当用户点击"输入密码"时,如何允许用户访问内置的Apple密码屏幕?请单击下面提供的链接以查看此问题的图像说明.感谢您的帮助,请在Swift中写下来!
在我的iOS 7 iPad应用中,LAContext:evaluatePolicy有时会返回SUCCESS而不提示用户触摸ID按钮。苹果文档说:“评估策略可能涉及提示用户……”。
我的身份验证策略设置为LAPolicyDeviceOwnerAuthenticationWithBiometrics,这是我看到的唯一选择。为什么每次我调用评价策略时,都不会提示用户触摸ID按钮?有没有办法我可以要求这种行为?
我正在使用iOS的LocalAuthentication框架,并遵循网络上的一般教程为我的应用程序实现TouchID身份验证.
当应用程序调用context.evaluatePolicy(policy,error:&error)时,我想向用户显示"输入密码"选项,而不是让用户选择"取消"以关闭对话框并输入密码.
这是AppStore应用程序中的默认行为,但我无法让我的应用程序以相同的方式执行.请参阅下面的AppStore截图:
我使用的代码与各种教程一致.见下面的代码.
我的应用程序启动时显示以下屏幕:
我在SO和其他网站上搜索过高和低,但是无法使用"显示密码"启动我的应用程序.当我使用未注册的手指来验证LA对话框时,请更改为"再试一次"并显示"显示密码"按钮.
let context = LAContext()
var error : NSError?
// Test if TouchID policy is available on the device and a fingerprint has been enrolled.
var policy : LAPolicy!
if #available(iOS 9.0, *) {
policy = (context.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error:&error) ? LAPolicy.DeviceOwnerAuthenticationWithBiometrics : LAPolicy.DeviceOwnerAuthentication)
} else {
// Fallback on earlier versions
policy = LAPolicy.DeviceOwnerAuthenticationWithBiometrics
}
if context.canEvaluatePolicy(policy, error:&error) {
// evaluate
context.evaluatePolicy(policy, localizedReason: reason, reply: {
(success: Bool, authenticationError: NSError?) -> Void in
// check whether …
Run Code Online (Sandbox Code Playgroud) 我使用Touch id识别我的应用程序中的iPhone用户,何时canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics
用于评估用户是否有资格使用Touch ID,但在许多尝试失败后,即使用户有资格使用触摸ID,它也会返回FALSE
.
这将导致应用程序跳过此步骤并认为此设备不支持触摸ID.
这是我得到的错误:
Error Domain = com.apple.LocalAuthentication Code = -8"Biometry被锁定." UserInfo = {NSLocalizedDescription = Biometry被锁定.}
在我的应用程序中,用户可以使用电子邮件/密码验证/登录我的后端.现在我正在考虑实现触摸ID.
但我对使用触摸ID的登录流程感到困惑.
使用下面的代码,我可以轻松验证用户:
func authenticateUser() {
let context = LAContext()
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
let reason = "Identify yourself!"
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) {
[unowned self] success, authenticationError in
DispatchQueue.main.async {
if success {
self.runSecretCode()
} else {
let ac = UIAlertController(title: "Authentication failed", message: "Sorry!", preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "OK", style: .default))
self.present(ac, animated: true)
}
}
}
} else {
let ac = UIAlertController(title: "Touch ID not available", message: "Your device is not configured for Touch …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Ionic 2应用程序中使用TouchID。我有iphone 5c,所以无法在真实设备上测试。
我导入了包裹:
import { TouchID } from 'ionic-native';
Run Code Online (Sandbox Code Playgroud)
然后,我测试了第一个功能(我已经在模拟器的硬件部分中激活了touchID):
TouchID.isAvailable()
.then(
res => console.log('TouchID is available!'),
err => console.error('TouchID is not available', err)
);
Run Code Online (Sandbox Code Playgroud)
一切正常。现在我想做的就是测试这个功能:
TouchID.verifyFingerprint('Scan your fingerprint please')
.then(
res => console.log('Ok', res),
err => console.error('Error', err)
);
Run Code Online (Sandbox Code Playgroud)
可以在模拟器上进行测试吗?仿真器可以听指纹动作吗?
我正在尝试实施Touch ID登录,但是当用户失败超过最大尝试次数时,我收到此错误"Error Domain = com.apple.LocalAuthentication Code = -8"Biometry被锁定."UserInfo = {NSLocalizedDescription = Biometry is被锁在外面.}"
我想知道:
谢谢!
我正在尝试获取以下功能中的Face ID或Touch ID是否成功
func authenticate() -> Bool{
let context = LAContext()
var error: NSError?
guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
return false
}
var returnValue = false
let reason = "Face ID authentication"
context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason)
{
isAuthorized, error in
guard isAuthorized == true else {
return print(error)
}
returnValue = true
print("success")
}
return returnValue
}
Run Code Online (Sandbox Code Playgroud)
但是即使此代码成功执行,它也会跳过,returnValue = true
稍后再传递,导致返回错误。为什么会这样?以及如何解决此代码以使其像预期的那样工作?
上面的代码来自此链接 ,以防万一此人正在观看,谢谢。
我已react-native-fingerprint-scanner
在我的应用程序中实现的正常工作Touch Id
。
现在,我想为两个平台的Touch ID,Face ID和密码进行身份验证
是否可以检查您的设备是否分别要求支持lock pattern
?
我也尝试过使用react-native-touch-id
但它对我不起作用Face Id
有什么方法可以在两个平台(iOS / android)上实现这一目标吗?
参考:链接
touch-id ×10
ios ×9
swift ×4
objective-c ×3
face-id ×2
fingerprint ×2
iphone ×2
emulation ×1
ionic2 ×1
lacontext ×1
passcode ×1
react-native ×1