ios11适配

iOS11,touchId,faceId判断

2017-10-09  本文已影响177人  沉默学飞翔

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判断");
    }
上一篇下一篇

猜你喜欢

热点阅读