小编San*_*pta的帖子

如何在iOS 10中使用TouchID

我想在我的iOS应用程序中实现本地身份验证安全性但是我收到错误而无法弄清楚我为什么会这样做.

我正在使用iPhone 5s.这有关系吗?

码:

import UIKit
import LocalAuthentication

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func action(_ sender: Any) {
        authenticateUser()
    }

    func authenticateUser() {
        let authContext : LAContext = LAContext()
        var error: NSError?

        if authContext.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &error){
            authContext.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Biometric Check for application", reply: {(successful: Bool, error: …
Run Code Online (Sandbox Code Playgroud)

ios touch-id swift3

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

Google登录服务器身份验证代码是否没有iOS?

我们已经在应用程序中使用Google登录了。我们在请求登录时提供了serverClientID。

我们将user.serverAuthCode设置为nil。

我们的要求如下:

func googleLogin(){
            var configureError: NSError?
            GGLContext.sharedInstance().configureWithError(&configureError)
            assert(configureError == nil, "Error configuring Google services: \(configureError)")

            let gid = GIDSignIn.sharedInstance()
            if let path = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist") {
                let myDict = NSDictionary(contentsOfFile: path)
                gid?.serverClientID = "our servers cliet id as configured over firebase"

// This client id of our ios app we are getting from
// GoogleService-info.plist 
                gid?.clientID = myDict!.value(forKey: "CLIENT_ID") as! String

            }
            //        gid?.serverClientID = "our_servers" // TODO: fetch from plist
            gid?.scopes.append("https://www.googleapis.com/auth/gmail.readonly")
            print("\nClient Id: \(gid!.clientID!) Server …
Run Code Online (Sandbox Code Playgroud)

google-api ios google-oauth swift gmail-api

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

标签 统计

ios ×2

gmail-api ×1

google-api ×1

google-oauth ×1

swift ×1

swift3 ×1

touch-id ×1