【发布时间】:2014-11-18 08:03:19
【问题描述】:
我想在仅处于横向模式的应用中使用 TouchID。一切正常,但身份验证警报仅以纵向模式显示。我该怎么办?
这是我的代码:
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = [[NSString alloc] initWithUTF8String: title];
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
NSLog(@"Authenticated using Touch ID.");
//do something
} else {
// User did not authenticate successfully, look at error and take appropriate action
if (authError.code == kLAErrorUserFallback) {
NSLog(@"User tapped Enter Password");
} else if (authError.code == kLAErrorUserCancel) {
NSLog(@"User tapped Cancel");
} else {
NSLog(@"Authenticated failed.");
}
}
}];
} else {
// Could not evaluate policy; look at authError and present an appropriate message to user
NSLog(@"Touch ID is not available: %@", authError);
}
【问题讨论】:
标签: ios8 landscape fingerprint