2016-07-20 5 views
0

私は現在自分のアプリでtouchIDを持っており、現在正しく動作しています。あなたがログインするたびに、「touchID activated」警告がポップアップするたびにちょっと迷惑です。それを変更する方法はありますか?最初にログインするだけで、もう一度は表示されません。ここではタッチIDのための私のコードは、私は、ログイン画面の中のviewDidLoad checkIfTouchIDActivated()を呼び出す:アプリにログインするたびに「touch ID activated」アラートを無効にするにはどうすればよいですか?

// MARK: TouchID 

    //Create a authentication context 
    let authenticationContext = LAContext() 
    var error:NSError? 


    //Check if the device has a fingerprint sensor, if not, dismiss 
    func checkIfTouchIDActivated() { 

    guard authenticationContext.canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: &error) else { 
     print("TouchID not detected") 
     return 
    } 
    print("TouchID detected") 

    //Check the fingerprint 
    authenticationContext.evaluatePolicy(
     .DeviceOwnerAuthenticationWithBiometrics, 
     localizedReason: "TouchID activated", 
     reply: { [unowned self] (success, error) -> Void in 

     //fingerprint has been recognized 
     if(success){ 

      self.loginButtonPressed(self) 

     }else { 

      // Check if there is an error 
      if let error = error { 

      let message = self.touchID.errorMessageForLAErrorCode(error.code) 
      self.showAlertViewAfterEvaluatingPolicyWithMessage(message) 

      } 

     } 

     }) 
    } 

答えて

0

あなたはlocalizedReasonとして"TouchID activated"を与えてくれました。あなたに彼を認証する理由をユーザーに示したくない場合は、""としてください。通常"Are you the device owner?"、または"Sign in with your touch-ID"のような理由で、ユーザーからtouch-idの認証を要求する理由が示されます。

関連する問題