123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import UIKit
- class CommonLocalAuthentication: NSObject {
- class func localAuthentication() {
- let context = LAContext()
- context.localizedFallbackTitle = "*"
- if #available(iOS 10.0, *) {
- context.localizedCancelTitle = "取消"
- } else {
-
- }
- var error: NSError?
- if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
- context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "需要验证您的touch ID", reply: { (success, _) in
- if success {
- print("===登录成功====")
- } else {
- print("===登录验证失败====")
- }
- })
- } else {
- print("===不支持指纹识别====")
- }
- }
- }
|