Determine if an iOS device supports TouchID without setting passcode

前端 未结 7 1714
一生所求
一生所求 2020-12-25 13:27

I\'m currently developing an iOS app that enables users to log in to the app using TouchID, but firstly they must set up a password inside the app first. Problem is, to show

7条回答
  •  囚心锁ツ
    2020-12-25 14:03

    For iOS 11+ you can use biometryType: LABiometryType of LAContext. More from Apple documentation:

    /// Indicates the type of the biometry supported by the device.
    ///
    /// @discussion  This property is set only when canEvaluatePolicy succeeds for a biometric policy.
    ///              The default value is LABiometryTypeNone.
    @available(iOS 11.0, *)
    open var biometryType: LABiometryType { get }
    
    @available(iOS 11.0, *)
    public enum LABiometryType : Int {
    
        /// The device does not support biometry.
        @available(iOS 11.2, *)
        case none
    
        /// The device does not support biometry.
        @available(iOS, introduced: 11.0, deprecated: 11.2, renamed: "LABiometryType.none")
        public static var LABiometryNone: LABiometryType { get }
    
        /// The device supports Touch ID.
        case touchID
    
        /// The device supports Face ID.
        case faceID
    }
    

提交回复
热议问题