2016-01-14 19 views

回答

3

據我所知,這是不可能的。

0

我不知道爲什麼你想知道,但是,你可以隨時檢查設備是否支持TouchID,以及是否已經由用戶設置。您可以通過創建LAContext(本地認證上下文)並調用函數canEvaluatePolicy:error:來完成此操作。這就是我認爲你可以通過應用程序瞭解給定iPhone上的TouchID設置。我希望這會有所幫助:)

2

NO。沒有辦法知道用戶是否選擇使用TouchID解鎖手機。

有方法canEvaluatePolicy:錯誤:

但是這告訴你,如果TouchId配置/啓用或未配置/未啓用。如果您想檢查空房觸摸標識爲您的應用程序,你可以使用canEvaluatePolicy:錯誤:

-(void)canEvaluatePolicy {
LAContext *context = [[LAContext alloc] init];
__block NSString *message; NSError *error; BOOL success;

// test if we can evaluate the policy, this test will tell us if Touch ID is available and enrolled 
success = [context canEvaluatePolicy: <BR>LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]; 
if (success) { 
    message = [NSString stringWithFormat:@"Touch ID is available"]; 
} 
else { 
    message = [NSString stringWithFormat:@"Touch ID is not available"]; 
} 


[super printMessage:message inTextView:self.textView]; 

}

你可以找到developer.apple.com網站完全工作代碼:

https://developer.apple.com/library/content/samplecode/KeychainTouchID/Listings/KeychainTouchID_AAPLLocalAuthenticationTestsViewController_m.html