Latest 0.0.1
Homepage https://github.com/Smiacter/TouchIdManager
License MIT
Platforms ios 8.0
Authors

Description

TouchId/FaceId manager use on iOS 8 or later iOS 8以上的指纹/面容解锁简单封装

CocoaPods
CocoaPods
CocoaPods

Function              

  • support iOS8+ 兼容iOS8以上系统
  • support face id 支持面容解锁   
  • support show system pwd to reactive touch id 支持锁定后弹出系统密码确认

Usage

  1. Drop TouchIdManager fold to your project 将TouchIdManager文件夹拖到你的工程目录

  2. add notification to hanle error 添加错误处理通知,在当前VC处理解锁失败
NotificationCenter.default.addObserver(self, selector: #selector(touchIdErrorHandle(noti:)), name: NSNotification.Name(rawValue: KeyNotificationTouchIdFail), object: nil)
  1. use singleton to active touch id 唤起解锁
TouchIDManager.shared.useTouchIdUnlock(unlockSuccess: {
            // success handle
            self.dismiss(animated: true, completion: nil)
        }) { (errorType) in
        }
  1. handle error 处理解锁失败
func touchIdErrorHandle(noti: Notification) {
        // type: 1-锁定后验证系统密码成功 0-点击使用密码登录 -1-锁定后验证系统密码失败 -2-验证失败,指纹不匹配
        //       -3-点击取消按钮 -4-被系统取消 -5-被应用取消
        if let userInfo = noti.userInfo, let type = userInfo["type"] as? Int {
            DispatchQueue.main.async {
                switch type {
                case 1:
                    self.touchIdUnlock()
                case 0:
                    break
                case -1:
                    break
                case -2:
                    let alertVC = UIAlertController(title: "提示", message: "指纹不匹配", preferredStyle: .alert)
                    alertVC.addAction(UIAlertAction(title: "确定", style: .default, handler: { (alert) in

                    }))
                    self.present(alertVC, animated: true, completion: nil)
                case -3:
                    break
                case -4:
                    break
                case -5:
                    break
                default:
                    break
                }
            }
        }
    }

License

KJTouchIdManager is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "KJTouchIdManager",
    "module_name": "TouchIdManager",
    "version": "0.0.1",
    "summary": "TouchId/FaceId manager on iOS 8 or later.",
    "description": "An easy way to use TouchId or FaceId, support iOS 8 or later",
    "homepage": "https://github.com/Smiacter/TouchIdManager",
    "license": "MIT",
    "authors": {
        "Smiacter": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "4.1",
    "source": {
        "git": "https://github.com/Smiacter/TouchIdManager.git",
        "tag": "0.0.1"
    },
    "source_files": "TouchIdManager/*.swift"
}

Pin It on Pinterest

Share This