iOS调用TouchID代码:
override func viewDidLoad() { super.viewDidLoad() let context = LAContext() var error: NSError? = nil let canEvaluatePolicy = context.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &error) as Bool if error != nil { print(error!.localizedDescription as String) } if canEvaluatePolicy { print("有指纹验证功能") context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: "放上您的狗爪", reply: { (success: Bool, error: Error?) in if success { print("验证成功") } else { print("验证失败: /(error?.localizedDescription)") } }) } else { print("还没开启指纹验证呢") } }
以上所述是小编给大家介绍的iOS开发中Swift 指纹验证功能模块实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对VEVB武林网网站的支持!
新闻热点
疑难解答