지침과 애플의 Touch ID API 예제를 따라했습니다. 내 응용 프로그램에서 예제를 사용했습니다. Touch ID를 사용하여 로그인 할 수있었습니다. 그러나 문제는 반응이 매우 느리다는 것입니다. 터치 ID에 손가락을 대고 10 초 이상 기다렸다가 성공/실패 여부를 확인해야합니다. app 위임 파일에서 코드를 사용했습니다. 나는 또한 다른 애플 리케이션으로 테스트했지만 결과는 동일한 "지연된 응답"입니다. 얘들 아 나 좀 도와 줘.터치 ID API가 반응이 매우 느림
7
A
답변
22
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = <#String explaining why app needs authentication#>;
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
dispatch_async(dispatch_get_main_queue(), ^{
// write all your code here
});
} else {
// User did not authenticate successfully, look at error and take appropriate action
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;
default:
NSLog(@"Touch ID is not configured");
break;
}
NSLog(@"Authentication Fails");
}
}];
} else {
// Could not evaluate policy; look at authError and present an appropriate message to user
}
+0
@vishal ... 고맙습니다. 그것은 완벽하게 작동했습니다 :) – user4150758
+0
@ user4150758 welcome .. !! –
+0
누군가 블록 실행 후 스레드가 수행하는 작업을 설명 할 수 있습니까? – Rainelz
6
당신은 다른}
dispatch_async(dispatch_get_main_queue(), ^{
//update ui
});
LAContext *context = [[LAContext alloc] init];
NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
// Authenticate User
NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"Please verify that you are the device owner in order to place the order"
reply:^(BOOL success, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"There was a problem verifying your identity."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
return;
}
if (success) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"You are the device owner!"
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"You are not the device owner."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
});
}];
}
으로 메인 스레드에서 alertviews을 표시 할 수있는 다른, 당신은 UI의 일을 할 필요가 말했듯이 {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Your device cannot authenticate using TouchID."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
1
주 스레드에서 Swift 3.0의 경우 :
myContext.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { (success, evaluateError) in
DispatchQueue.main.async {
if (success) {
//success
} else {
//failure
}
}
}
관련 문제
- 1. Wordpress는 Openshift에서 반응이 매우 느림
- 2. 원격 API가 매우 느림
- 3. Tweepy user_search api가 매우 느림
- 4. YouTube get_video_info API가 매우 느림
- 5. 반응이 느림 입력 변경시
- 6. Google 지오 코딩 API가 갑자기 매우 느림
- 7. UpdatePanel 내의 FireFox에서 asp.net LinkButton의 반응이 매우 느림
- 8. 간단한 DB 쿼리를 수행 할 때 CakePHP의 반응이 매우 느림
- 9. iOS 성능이 매우 느림
- 10. 부트 스트랩에서 헤드 반응이 느림
- 11. 여러 요청을 할 때 Facebook의 그래프 API가 매우 느림
- 12. Drupal 7 데이터베이스 API가 PHP에 비해 매우 느림 mysqli_connect()
- 13. visual studio 매우 매우 느림
- 14. R 코드가 매우 느림
- 15. 안드로이드 - XPath 매우 느림
- 16. iPhone UIDatePicker 매우 느림
- 17. JQGrid 모두 매우 느림
- 18. PHP가 갑자기 매우 매우 매우 느림
- 19. 매우 느림 MFMailComposeViewControllerDelegate
- 20. IE에서 매우 jQuery가 느림
- 21. MySQL 쿼리가 매우 느림
- 22. OpenMP에서 감소가 매우 느림
- 23. cakephp paginator 매우 느림
- 24. 쿼리 결과가 매우 느림
- 25. VS 2010 매우 느림
- 26. VisualStudio2005 디버깅이 매우 느림
- 27. Stanford CoreNLP 매우 느림
- 28. devenv/installvstemplates 매우 느림
- 29. PyQT QTableWidget 매우 느림
코드를 디스패치 큐에 써야합니까? – user4150758
나는 이것을 또한 알아 차렸다. 나는 애플의 예를 따랐다. 콜백을 받기까지는 상당한 시간이 걸렸다. 누군가에 대한 답변이 있기를 바란다. 애플의 설명서가 부족하기 때문이다. – Inertiatic
예. 하지만 1password가 어떻게 완벽하게 작동하는지 확신 할 수 없습니다. – user4150758