2016-08-25 5 views
0

iOS 9.xでは、バイオメトリックログインを5回(3回と2回)試行した後、iOSによって自動的にデフォルトのピンコード画面がポップアップ表示されます。これはiOS 10 Betaでは発生しません。代わりに、単に "canEvaluatePolicy"チェックに失敗します。誰かがこれがiOS 10 Betaのバグかどうか知っていますか、何とかピンコードをサポートするコードを追加する必要がありますか?ここでiOS 10 beta - TouchIDログインがピンパッドをポップアップしない

はコードです:

-(void)touchTester { 
    LAContext *myContext = [[[LAContext alloc] init] autorelease]; 
    NSError *authError = nil; 

    NSString *myLocalizedReasonString = @"Sign on with TouchID\u00AE or enter password."; 
    myContext.localizedFallbackTitle = @"Enter Password"; 

    self.touchIdActive = NO; 
    if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) { 
     [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics 
        localizedReason:myLocalizedReasonString 
          reply:^(BOOL success, NSError *error) { 
           if (success) { 
            self.touchIdActive = YES; 
            dispatch_async(dispatch_get_main_queue(), ^{ 

             NSLog(@"Launching loginUser"); 
             [self loginUser:YES]; 
            }); 
           } else { 
            self.touchIdActive = NO; 

            NSString * errMsg = error.localizedDescription; 
            if (![errMsg isEqualToString:@"Canceled by user."]) { 
             dispatch_async(dispatch_get_main_queue(), ^{ 
              UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" 
                           message:errMsg 
                           delegate:self 
                         cancelButtonTitle:@"OK" 
                         otherButtonTitles:nil, nil]; 
              [alertView show]; 
             }); 
            } 
           } 
          }]; 
    } else { 
     // This is where we go after lockout in iOS 10 
     dispatch_async(dispatch_get_main_queue(), ^{ 
      UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" 
                   message:authError.localizedDescription 
                   delegate:self 
                 cancelButtonTitle:@"OK" 
                 otherButtonTitles:nil, nil]; 
      [alertView show]; 
     }); 
    } 
} 
+0

あなたが持っているどのようなiOSのベータ版10。私は7を持っています。しかし、iOS10のすべてのベータは今年夏に働いていました。あなたの状況をもう少し詳しく説明してください。 – pedrouan

+0

コードを表示できますか? – Paulw11

+0

さて、私は今日それをロードしました。電話はそれを10.と呼びます(14A5345a)。基本的に私は自分のアプリにTouchIDサポートを追加しました。バイオメトリック認証を3回連続して失敗した場合は、「自動再試行制限を超えました」という返信を自動で送信する「自動」機能があります。エラー。もう一度やり直すとバイオメトリック認証が2回失敗すると、iOS 10は「バイオメトリがロックアウトされました」と返します。エラー。 iOS 9では、後者の場合、TouchIDピンを再入力できるようにキーパッドが用意されています。 – PsychicPuppy

答えて

3

は、コードを示します。

LAContext *myContext = [[LAContext alloc] init]; 
myContext.localizedFallbackTitle = [InternationalControl localStringByKey:@"gesture_forget"]; 
NSError *authError = nil; 
NSString *myLocalizedReasonString = [InternationalControl localStringByKey:@"touchHome"]; 

BOOL isOK = [myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]; 
if (isOK) { 
    [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics 
       localizedReason:myLocalizedReasonString 
     reply:^(BOOL success, NSError *error) { 
      NSLog(@" 查看是什么情况 %@",error); 
      TouchType typeState = TouchTypeOther; 
      if (success) { 
       NSLog(@"解锁成功"); 
      } else { 
       if(error.code == -8){ 
        dispatch_async(dispatch_get_main_queue(), ^{ 
         LAContext *myContext = [[LAContext alloc] init]; 
         myContext.localizedFallbackTitle = [InternationalControl localStringByKey:@"gesture_forget"]; 
         NSError *authError = nil; 
         NSString *myLocalizedReasonString = [InternationalControl localStringByKey:@"touchHome"]; 
         BOOL isOK = [myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:&authError]; 
         if (isOK) { 
          [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthentication localizedReason:myLocalizedReasonString 
           reply:^(BOOL success, NSError *error) { 
            NSLog(@" 查看是什么情况 %@",error); 
           }]; 
         } 
        }); 
       } 
      } 
     }]; 
} else { 

    if(authError.code == -8){ 
     dispatch_async(dispatch_get_main_queue(), ^{ 
      LAContext *myContext = [[LAContext alloc] init]; 
      myContext.localizedFallbackTitle = [InternationalControl localStringByKey:@"gesture_forget"]; 
      NSError *authError = nil; 
      NSString *myLocalizedReasonString = [InternationalControl localStringByKey:@"touchHome"]; 
      BOOL isOK = [myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthentication error:&authError]; 
      if (isOK) { 
       [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthentication localizedReason:myLocalizedReasonString 
        reply:^(BOOL success, NSError *error) { 
         NSLog(@" 查看是什么情况 %@",error); 
        }]; 
      } 
     }); 
    } 
    NSLog(@"%@",authError); 
}