[英]How to check whether the FACEID has been disallowed by the user in iOS App?
當啟用 Touch ID 的應用程序首次在 iPhone X 上運行時,系統會詢問用戶是否要改用 Face ID。 如果他們拒絕,則 Face ID 將被禁用,並且用戶再也無法選擇使用該功能。 除了刪除並重新安裝應用程序之外,還有另一種啟用面容 ID 的方法嗎? 授權圖片如下所示:
我使用以下代碼來像這樣集成 FaceID:
- (void)authenicateButtonTapped{
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = @"Touch ID Test";
myContext.localizedFallbackTitle = @"";
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
NSLog(@"success");
if (success) {
NSString *str = @"You are the owner of device";
NSArray * result = [[NSArray alloc] initWithObjects:str,nil];
dispatch_async(dispatch_get_main_queue(), ^{
// executeClosure(callBack, result, NO);
});
} else {
switch (error.code) {
case LAErrorAuthenticationFailed:
NSLog(@"Authentication Failed");
break;
case LAErrorUserCancel:
NSLog(@"User pressed Cancel button");
break;
case LAErrorUserFallback:
NSLog(@"User pressed Enter Password");
break;
case LAErrorPasscodeNotSet:
NSLog(@"Passcode Not Set");
break;
case LAErrorBiometryNotAvailable:
NSLog(@"Touch ID not available");
break;
case LAErrorBiometryNotEnrolled:
NSLog(@"Touch ID not Enrolled or configured");
break;
default:
NSLog(@"Touch ID is not configured");
break;
}
NSArray * result = [[NSArray alloc] initWithObjects:error.localizedDescription,nil];
NSLog(@"Failure error: %@", result);
dispatch_async(dispatch_get_main_queue(), ^{
// executeClosure(callBack, result, NO);
// Rather than show a UIAlert here, use the error to determine if you should push to a keypad for PIN entry.
});
}
}];
} else {
NSArray * result = [[NSArray alloc] initWithObjects:authError.localizedDescription,nil];
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Failure %@",result);
// executeClosure(callBack, result, NO);
// Rather than show a UIAlert here, use the error to determine if you should push to a keypad for PIN entry.
});
}
}
請告訴我一旦我按下“不允許”,當我再次使用該應用程序時,如何檢查之前是否未授予權限? 基於此,我可以通過轉到設置頁面來要求用戶啟用,但截至目前,我一直在思考如何確定權限是否較早被拒絕。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.