2017-11-07 42 views

답변

6

시뮬레이터는 그냥 터치 ID로 수행처럼 정확하고 실패한 얼굴 인식의 결과를 시뮬레이션합니다. 은 얼굴을 인식하지 못합니다.

+0

감사합니다. 나는 생체 인식으로 처음으로 일하고있다. 따라서 우리는 인증 과정에서 match face를 눌러서 성공적으로 인증을 받아야합니다. – technerd

1

을 묻는 질문을했지만 사용 설정 한 후에는 어떻게해야합니까?

터치 ID 등록과 마찬가지로 iPhone-X에서 face-Id를 사용하여 인증 할 수 있습니다.

  • 사용 얼굴 ID 구매를 위해 - 그러나 앱 스토어 등 당신이 일 다음과 같은 작업을 수행 할 수 얼굴-ID 등록과 함께 같은 몇 가지 제한이 시뮬레이터.
  • 얼굴 ID로 로그인 (앱에 로그인).
  • Safari의 자동 완성 암호입니다.
  • iTunes Store, App Store 및 iBooks Store.

See more at Apple

+0

의견을 보내 주셔서 감사합니다. 자세한 내용은 링크를 확인하겠습니다. – technerd

6

시뮬레이터 얼굴을 인식하지만 Face ID에서 Enrolled 옵션을 설정 한 경우, 일치와 일치하지 않는 얼굴을 시뮬레이션 할 수 없습니다.

추가 뷰 컨트롤러에 코드를 다음과 앱 FaceID 탐지를 허용하는 처음 메시지를 표시합니다


FaceID 인증

import LocalAuthentication class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() localAuthentication() } func localAuthentication() -> Void { let laContext = LAContext() var error: NSError? let biometricsPolicy = LAPolicy.deviceOwnerAuthenticationWithBiometrics if (laContext.canEvaluatePolicy(biometricsPolicy, error: &error)) { if let laError = error { print("laError - \(laError)") return } var localizedReason = "Unlock device" if #available(iOS 11.0, *) { if (laContext.biometryType == LABiometryType.faceID) { localizedReason = "Unlock using Face ID" print("FaceId support") } else if (laContext.biometryType == LABiometryType.touchID) { localizedReason = "Unlock using Touch ID" print("TouchId support") } else { print("No Biometric support") } } else { // Fallback on earlier versions } laContext.evaluatePolicy(biometricsPolicy, localizedReason: localizedReason, reply: { (isSuccess, error) in DispatchQueue.main.async(execute: { if let laError = error { print("laError - \(laError)") } else { if isSuccess { print("sucess") } else { print("failure") } } }) }) } } } 
FaceID

으로 시도합니다. enter image description here


지금 페이스 ID 등록을 활성화하고 얼굴 ID 시뮬레이션 테스트를 테스트하여 응용 프로그램을 실행합니다.

일치하는 얼굴과 일치하지 않는 얼굴의 시뮬레이션 결과입니다. 일치하는 얼굴

결과 : 비 매칭 얼굴

enter image description here


결과 :

enter image description here

+0

어떻게하면 그 정사각형의 얼굴 ID 프롬프트를 사용자 정의 할 수 있습니까? 텍스트를 추가하고 싶습니다. 가능한가? –

0

같으면 @krunal 단지 2에서 수득로서 1 위가되어야합니다.

import LocalAuthentication 

class ViewController: UIViewController { 

override func viewDidLoad() { 
    super.viewDidLoad() 
    localAuthentication() 
} 

func localAuthentication() -> Void { 

    let laContext = LAContext() 
    var error: NSError? 
    let biometricsPolicy = LAPolicy.deviceOwnerAuthenticationWithBiometrics 

    if (laContext.canEvaluatePolicy(biometricsPolicy, error: &error)) { 



     var localizedReason = "Unlock device" 
     if #available(iOS 11.0, *) { 
      if (laContext.biometryType == LABiometryType.faceID) { 
       localizedReason = "Unlock using Face ID" 
       print("FaceId support") 
      } else if (laContext.biometryType == LABiometryType.touchID) { 
       localizedReason = "Unlock using Touch ID" 
       print("TouchId support") 
      } else { 
       print("No Biometric support") 
      } 
     } else { 
      // Fallback on earlier versions 
     } 


     laContext.evaluatePolicy(biometricsPolicy, localizedReason: localizedReason, reply: { (isSuccess, error) in 

      DispatchQueue.main.async(execute: { 

       if let laError = error { 
        print("laError - \(laError)") 
       } else { 
        if isSuccess { 
         print("sucess") 
        } else { 
         print("failure") 
        } 
       } 
      }) 
     }) 
    } 
//This should be outside of if 

if let laError = error { 
     print("laError - \(laError)") 
     return 
    } 
} 
}