Mel*_*rne 0 ios touch-id swift
我有一个用Swift制作的iOS应用程序,这是一个小社交网络.用户可以使用登录/密码连接,我将其保存在私人服务器上的数据库中.我想实现TouchID以帮助他们更快地登录.但是,我的用户帐户未与其Apple ID相关联.
// Touch ID button has been clicked
func touchIDButtonClicked() {
print("touchIDButtonClicked");
//Is Touch ID hardware available & configured?
if(authContext.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error:&error))
{
//Perform Touch ID auth
authContext.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason: "Connect to the network with your fingertips", reply: {(wasSuccessful:Bool, error:NSError?) in
if(wasSuccessful)
{
//User authenticated
print("OK");
// Log the user
}
else
{
//There are a few reasons why it can fail, we'll write them out to the user in the label
print("NO");
// Tell the user to use his password
}
})
}
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找的概念解决方案不仅仅是技术解决方案.我已经研究过TouchID了.有人能帮我吗 ?
Touch ID不会识别某个人(它无法告诉您它是用户1还是用户2).它验证一个人(电话的所有者).
因此,您无法单独使用Touch ID登录.您可以使用它,避免输入相同的凭据.
所以它会像这样工作: