Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fingerprint authentication problem after updated to iOS 13

I have an app need the fingerprint authentication when every time the app started, so that i have put the fingerprint authentication into applicationDidBecomeActive in AppDelegate.

After my iPad and Xcode updated to iOS 13, the fingerprint dialog popup delayed around 30 seconds to 1 min. (It is popup immediately before updated to iOS 13)

Has anyone had a similar situation?

if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error){
    let reason = "Fingerprint Login"

    context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason ) { success, error in

    if success {
        DispatchQueue.main.async { [unowned self] in
            print("Success")
        }                    
    } else {  
        print(error?.localizedDescription ?? "Failed to authenticate")
    }
}
like image 478
user3721070 Avatar asked Sep 25 '19 07:09

user3721070


1 Answers

I read that this is a common bug in iOS 13, i think they will fix it in the upcoming versions, for now just call context.evaluatePolicy twice like that :

if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error){
    let reason = "Fingerprint Login"

    if #available(iOS 13.0, *) {
        context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason ) { (_,_) in }
    }
    context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason ) { success, error in
        if success {
            DispatchQueue.main.async { [unowned self] in
                print("Success")
            }
        } else {
            print(error?.localizedDescription ?? "Failed to authenticate")
        }
    }
}
like image 163
YouSS Avatar answered Oct 15 '22 18:10

YouSS