日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

ios与android指纹识别,iOS开发swift -- 指纹识别

發(fā)布時(shí)間:2024/9/27 编程问答 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ios与android指纹识别,iOS开发swift -- 指纹识别 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

//導(dǎo)入類庫(kù) import LocalAuthentication

func touchID() {

//創(chuàng)建上下文

let context = LAContext()

var error : NSError?

//判斷設(shè)備是否支持指紋識(shí)別

if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error)

{

//開始指紋識(shí)別

context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "請(qǐng)用指紋解鎖", reply: { (success, error) in

if success {

debugPrint("successful")

//do what you want

}else

{

if let error = error as NSError?

{

switch error.code {

case LAError.appCancel.rawValue:

debugPrint("Authentication was cancelled by application")

case LAError.authenticationFailed.rawValue:

debugPrint("The user failed to provide valid credentials")

case LAError.invalidContext.rawValue:

debugPrint("The context is invalid")

case LAError.passcodeNotSet.rawValue:

debugPrint("Passcode is not set on the device")

case LAError.systemCancel.rawValue:

debugPrint("Authentication was cancelled by the system")

case LAError.touchIDLockout.rawValue:

debugPrint("Too many failed attempts.")

case LAError.touchIDNotAvailable.rawValue:

debugPrint("TouchID is not available on the device")

case LAError.userCancel.rawValue:

debugPrint("The user did cancel")

case LAError.userFallback.rawValue:

debugPrint("The user chose to use the fallback")

default:

debugPrint( "Did not find error code on LAError object")

}

}

}

})

}else

{

debugPrint("no support")

}

}

總結(jié)

以上是生活随笔為你收集整理的ios与android指纹识别,iOS开发swift -- 指纹识别的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。