iOS11,touchId,faceId判断

iPhoneX适配faceId:苹果官方技术文档:
https://developer.apple.com/documentation/localauthentication/labiometrytype

LAContext *context = [[LAContext alloc] init];
//判断是支持touchid还是faceid
    if (@available(iOS 11.0, *)) {
        switch (context.biometryType) {
            case LABiometryNone:
                NSLog(@"-----------touchid,faceid都不支持");
                break;
            case LABiometryTypeTouchID:
                NSLog(@"-----------touchid支持");
                break;
            case LABiometryTypeFaceID:
                NSLog(@"-----------faceid支持");
                break;
            default:
                break;
        }
    } else {
        // Fallback on earlier versions
        NSLog(@"-----------iOS11之前的版本,不做id判断");
    }

你可能感兴趣的:(iOS11,touchId,faceId判断)