如何在sirikit中使用TouchID

时间:2019-03-01 08:00:38

标签: ios swift siri sirikit sirishortcuts

我正在我的应用程序中浏览带有触摸ID的sirikit进行付款。在函数句柄中,我称为“触摸ID”函数,但是在siri UI中出现黑屏,如果有某种方法,有人可以帮助我。

func handle(intent: INSendPaymentIntent, completion: @escaping (INSendPaymentIntentResponse) -> Void) {
        guard let payee = intent.payee, let amount = intent.currencyAmount else {
        return completion(INSendPaymentIntentResponse(code: .unspecified, userActivity: nil))
        }
            LAContext().evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Allow siri to do the Payment", reply:
               {(accessGranted:Bool, error:Error?) -> Void in
                   if (accessGranted){
                       print("Sending \(amount) payment to \(payee)!")
                        completion(INSendPaymentIntentResponse(code: .success, userActivity: nil))
                    }
           })
        print("Sending \(amount) payment to \(payee)!")
        completion(INSendPaymentIntentResponse(code: .success, userActivity: nil))
    }

0 个答案:

没有答案