标签: touch-id

密码保护使用Touch ID的快速应用程序

我正在创建一个应用程序,用户可以存储其他人的信息,我想允许用户使用密码或Touch ID保护我的应用程序中存储的信息(如果他们的设备支持它).

由于Apple的文档,我已经有了Touch ID部分工作,但我仍然坚持如何实现密码锁.我是否必须为该密码输入创建另一个视图控制器?如何确保我的应用无法访问用户密码(如果应用被黑客攻击或在越狱设备上运行)?Apple是否为此目的提供框架或库?

有人能指出我可以使用的一些源代码或文档吗?

authentication touch-id swift xcode6 ios8

2
推荐指数
1
解决办法
5777
查看次数

TouchID错误代码:-1004 NSLocalizedDescription:需要用户交互

我正在使用触摸ID登录的应用程序.它应该仅在首次启动时询问触摸ID(即,当应用程序从后台输入前景时,我不要求触摸ID身份验证).以下是我展示touchID的方法:

AppDelegate.swift:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
   let loginViewController = storyboard.instantiateViewControllerWithIdentifier("login") as! LoginViewController
   rootViewController = loginViewController
   let navigationController = UINavigationController(rootViewController: rootViewController)
   window!.rootViewController = navigationController
}
Run Code Online (Sandbox Code Playgroud)

然后在LoginViewController的viewDidAppear()中我要求触摸如下:

LoginViewController.swift:

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)
    let context = LAContext()
    if context.canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: nil) {
       context.evaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics,
                                       localizedReason: NSLocalizedString("Login To Your Account", comment: ""),
                                       reply: { [weak self] (success, error) in
          dispatch_async(dispatch_get_main_queue(), {
             if success {
                self?.loginUser()
             } else if error!.code != LAError.UserCancel.rawValue {
                self?.focusOnPassword()
             } else 
          })
       }) …
Run Code Online (Sandbox Code Playgroud)

ios touch-id swift

2
推荐指数
1
解决办法
1530
查看次数

在Swift 3中使用未解析的标识符"LAContext"

Apple声称他们的武器库LAContext中有这个类,但Xcode 8.1告诉我:Use of unresolved identifier 'LAContext'

我的代码行如下:

let context = LAContext()
Run Code Online (Sandbox Code Playgroud)

对我来说,这行代码不会发疯;),所有在线教程都使用这个没问题来检查是否启用了TouchID,但在我的Xcode中,情况并非如此.

我错过了什么?

xcode touch-id swift

2
推荐指数
1
解决办法
1566
查看次数

iPhone:"指纹扫描仪"可作为API使用吗?

IOS中的"指纹识别"是否可用,或将来作为API提供?我想从我自己的应用程序中使用它,例如授权用户访问应用程序本身,或登录某些网页.

iphone ios touch-id

1
推荐指数
1
解决办法
1519
查看次数

检查LocalAuthentication中的错误类型

我知道这可能是一个简单的问题,但我无法在互联网上找到想要的东西。我在项目中使用的是iOS 8中的LocalAuthentication框架,代码在这里:

 if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
            [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
                    localizedReason:@"Let's just quickly check that you are the device owner."
                              reply:^(BOOL success, NSError *error) {
                                  dispatch_async (dispatch_get_main_queue(), ^{
                                      if (error) {
                                          // Error occurred
                                      } else if (success) {
                                          // Device owner, success!
                                      } else {
                                          // Not device owner
                                      }
                                  });
                              }];
        }
Run Code Online (Sandbox Code Playgroud)

但是我想知道用户何时点击“输入密码” LAErrorUserFallback。但是,我只想知道如何将error我那里的变量与进行比较,LAErrorUserFallback以查看结果错误。

我已经试过了:

if (error) {
    if (error == LAErrorUserFallback) {
       // User tapped 'Enter password'
    }
}
Run Code Online (Sandbox Code Playgroud)

但显然这些不是同一类型。

有什么帮助吗?

objective-c ios touch-id

1
推荐指数
1
解决办法
509
查看次数

swift - touchID需要很长时间才能加载

我正在努力将touchID集成到我的应用程序中.这个过程非常简单,但即使只是使用我的虚拟数据,它在执行任务之前需要大约5秒的时间来验证我的指纹.

这是我的代码:

func requestFingerprintAuthentication() {
    let context = LAContext()
    var authError: NSError?
    let authenticationReason: String = "Login"

    if context.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error: &authError) {
        context.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason: authenticationReason, reply: {
            (success: Bool, error: NSError?) -> Void in
            if success {
                println("successfull signin with touchID")
                self.emailInputField.text = "john.doe@gmail.com"
                self.passwordInputField.text = "password"
                self.signIn(self.signInButton)
            } else {
                println("Unable to Authenticate touchID")
            }
        })
    }
}
Run Code Online (Sandbox Code Playgroud)

即使使用虚拟数据,也需要花费太长时间.

当我正常登录时,通过在我的输入字段中键入电子邮件和密码,signIn()函数立即运行.

看看它是否有问题.我尝试用2行替换它,只需将我带到正确的viewController.但是在对我的指纹进行身份验证后仍需要几秒钟.

我知道这不是手机,也不是touchID.因为它立即运行我的println("使用touchID成功登录").之后是什么,由于某种原因它需要几秒钟才能运行?

任何帮助解释这一点将不胜感激!

ios touch-id swift xcode6

1
推荐指数
1
解决办法
656
查看次数

TouchID - 检测添加的新指纹 - evaluatePolicyDomainState何时更改?

我正在将TouchID集成到我的应用中.出于安全考虑,我允许用户打开和关闭它.我想让它在用户添加新指纹时自动关闭.根据Apple的说法,evaluatedPolicyDomainState

仅当canEvaluatePolicy(:error :)方法成功用于生物识别策略或调用evaluatePolicy(:localizedReason:reply :)方法并且执行成功的Touch ID身份验证时,此属性才返回值.否则,返回nil.

返回的数据是不透明的结构.它可用于与此属性返回的其他值进行比较,以确定授权指纹的数据库是否已更新.但是,无法根据此数据确定更改的性质.

但是,我正在添加一个新的指纹并evaluatedPolicyDomainState保持不变.

有关如何确保evaluatedPolicyDomainState更新或是否有其他方法检查是否添加新指纹的任何想法?

ios touch-id swift

1
推荐指数
2
解决办法
4819
查看次数

没有弹出视图的指纹

我想知道是否可以扫描指纹而不显示LAContext的弹出视图

在此输入图像描述

ios touch-id

1
推荐指数
1
解决办法
734
查看次数

无法在 iOS 11 中使用 swift 启动带有 URL 架构的 Touch ID 和密码

我正在使用下面的代码快速导航到该Touch ID and Passcode部分,

guard let profileUrl = URL(string : "App-Prefs:root=TOUCHID_PASSCODE") else {
            return
}

if UIApplication.shared.canOpenURL(profileUrl){
     if #available(iOS 10.0, *) {
                UIApplication.shared.open(profileUrl, options: [:], completionHandler: nil)
            } else {
                // Fallback on earlier versions
         }
 }
Run Code Online (Sandbox Code Playgroud)

它在 iOS 10 上工作正常。但现在不起作用。它仅导航至Settings,而不导航至该Touch ID & Passcode部分。任何原因。

url-scheme ios touch-id swift ios11

1
推荐指数
1
解决办法
1345
查看次数

适用于iOS 8.0中具有数据库Parse.com的登录用户的TouchID

大家好,我想做一个小问题...我在我的应用程序中使用parse.com.我的用户的登录过程是通过使用parse.com和用户在两个textField中键入的经典方法用户名和密码.

到目前为止一切正常但我想使用TouchID实现另一种登录方法,但是使用parse.com变得很难实现,因为touchID标识了印象,而且用户不在数据库Parse.com中,因此在使用TouchID时我的应用程序返回(正确)错误,因为它无法识别数据库中存在的用户...

有没有人设法使用生物识别TouchID的方法通过parse.com创建的登录??? 或者你知道是否有一种方法可以让我这样做?

谢谢你们

login ios parse-platform touch-id

0
推荐指数
1
解决办法
2282
查看次数

使用Touch ID不用于登录

是否可以在应用程序中使用Touch ID传感器,但不能用于登录身份验证?在应用程序中,用户可以扫描另一个人的手指.然后,指纹将与数据库匹配,找到该人的个人资料.

ios touch-id ios9

0
推荐指数
1
解决办法
1000
查看次数

使用Apple Touch ID登录外部数据库

我有一个用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)

ios touch-id swift

0
推荐指数
1
解决办法
891
查看次数

Swift 3(Xcode 8)中不存在canEvaluatePolicy函数中的"switch(error!.code)"

我正在将下面的代码转换为Swift 3.

 if context.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error:nil) {

  // 2.
  context.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics,
    localizedReason: "Logging in with Touch ID",
    reply: { (success : Bool, error : NSError? ) -> Void in

      // 3.
      dispatch_async(dispatch_get_main_queue(), {
        if success {
          self.performSegueWithIdentifier("dismissLogin", sender: self)
        }

        if error != nil {

          var message : NSString
          var showAlert : Bool

          // 4.
          switch(error!.code) {
Run Code Online (Sandbox Code Playgroud)

步骤4在Xcode 8,Swift 3上不再起作用.所以我不能做以下情况:

switch(error!.code) {
          case LAError.AuthenticationFailed.rawValue:
            message = "There was a problem verifying your identity."
            showAlert = true
            break;
Run Code Online (Sandbox Code Playgroud)

目前,似乎还没有我能找到的解决方案.有任何建议,请告诉我.

非常感谢!

error-code ios touch-id swift swift3

0
推荐指数
1
解决办法
2511
查看次数