iOS調(diào)用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("有指紋驗(yàn)證功能")
context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: "放上您的狗爪", reply: { (success: Bool, error: Error?) in
if success {
print("驗(yàn)證成功")
} else {
print("驗(yàn)證失敗: \(error?.localizedDescription)")
}
})
} else {
print("還沒開啟指紋驗(yàn)證呢")
}
}
以上所述是小編給大家介紹的iOS開發(fā)中Swift 指紋驗(yàn)證功能模塊實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)html5模板網(wǎng)網(wǎng)站的支持!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!