本文介绍了如何检查是否启用TouchID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以检查我的应用是否已启用TouchID,
Is there any way to check my application is enable with TouchID,
如何检查我的应用程序是否已启用TouchID,
How can i check if my application is enable with TouchID,
例如:
DropBox具有启用图形打印传感器启用的功能.现在有什么方法可以检查我的应用程序是否基于启用touchid来显示TouchID屏幕.
DropBox have capability to enable figure print sensor enable. now is there any method to check if my application showing TouchID screen based on touchid enable.
推荐答案
根据您使用的 Objective-C
According you use Objective-C
首先,添加检查iOS版本的方法
First, add method to check iOS Version
TouchID
需要iOS8 +才能运行
TouchID
needs iOS8+ to work
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
然后,使用LAContext
canEvaluatePolicy:error:
评估TouchID
是否存在
Then, use LAContext
canEvaluatePolicy:error:
to evaluate if TouchID
exist
- (BOOL)isTouchIDAvailable {
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
return [[[LAContext alloc] init] canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil];
}
return NO;
}
这篇关于如何检查是否启用TouchID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!