Sie sollten das LAContext-Framework verwenden, das für die Touch ID-Authentifizierung erforderlich ist.
LAErrorTouchIDNotAvailable zeigt an, welches Gerät über die Funktionalität verfügt.
Code-Snippet:
- (IBAction)shouldAuthenticate:(id)sender {
LAContext *context = [[LAContext alloc] init];
NSError *error = nil;
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
// Authentication here.
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Your device cannot authenticate using TouchID."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
}
oder versuchen, diese BOOL Rückkehr zu bekommen:
- (BOOL)canAuthenticateByTouchId {
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
return [[[LAContext alloc] init] canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil];
}
return NO;
}
http://stackoverflow.com/questions/11197509/ios-how-to-get -Gerät-machen-und-Modell. Verwenden Sie dies, um das Modell des Geräts zu finden. –