苹果faceid使用swift4

 

    func showAlert(title: String, message: String) {

        let okAction = AlertAction(title: OKTitle)
        let alertController = getAlertViewController(type: .alert, with: title, message: message, actions: [okAction], showCancel: false) { (button) in
        }
        present(alertController, animated: true, completion: nil)
    }
    
    func showLoginSucessAlert() {
        showAlert(title: "成功", message: "登陆成功(Login successful) ")
    }

//https://github.com/rushisangani/BiometricAuthentication/blob/master/BiometricAuthenticationExample/BiometricAuthenticationExample/ViewController.swift#L38
 

///https://github.com/MilanistaDev/AuthenticationTest

 

 

Face ID and Touch ID

 

Whenever possible, support biometric authentication. Face ID and Touch ID are secure, familiar authentication methods that people trust. If a user has enabled biometric authentication, you can assume they understand how it works, appreciate its convenience, and prefer to use it whenever possible. Bear in mind that people may choose to disable biometric authentication on their device, so your app should be prepared to handle this scenario.

Present people with a single way to authenticate. It's most intuitive when people don't have to choose how to authenticate. Just give them a single option, like Face ID. Offer alternatives, like asking for a username and password, as fallbacks only if the initial method fails.

Initiate authentication only in response to user action. An explicit action, like tapping a button, ensures that the user wants to authenticate. In the case of Face ID, it also increases the likelihood that the user is facing the camera.

Always identify the authentication method. A button for signing in to your app using Face ID, for example, should be titled "Sign In with Face ID" rather than "Sign In."

Reference authentication methods accurately. Don't reference Touch ID on a device that supports Face ID. Conversely, don't reference Face ID on a device that supports Touch ID. Check the device's capabilities and use the appropriate terminology. For developer guidance, see LABiometryType.

In general, avoid offering a setting for opting in to biometric authentication within your app. If biometric authentication is enabled at the system level, just assume the user wants to use it. If you implement an app-specific setting, the user may get into a state where biometric authentication appears to be enabled in your app when it's really disabled systemwide.

Don't use icons to identify system authentication features. When people see icons that look like the system's Touch ID (thumbprint) and Face ID icons, they think they're supposed to authenticate. Using icons to identify authentication features creates inconsistency and causes confusion, especially when the icons are colorized, displayed at a large size, and presented out of context.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值