Siri:IntentHandler无法正常使用设备Touch ID

时间:2016-09-25 10:54:27

标签: payment ios10 sirikit

使用LocalAuthentication处理设备NSIntent的正确方法是什么?目前,它没有显示在Siri INSendPaymentIntent中弹出的付款。

- (void)handleSendPayment:(INSendPaymentIntent *)intent
           completion:(void (^)(INSendPaymentIntentResponse *response))completion {

        __block INSendPaymentIntentResponse *siriResponse;

        LAContext *context = [[LAContext alloc] init];
        NSError *error = nil;

        // Check if device supports TouchID
        if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {

            // TouchID supported, show it to user
            [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics

                    localizedReason:@"Unlock using Touch ID to transaction”
                              reply:^(BOOL success, NSError *error) {

                                  if (success) {
                                      // This action has to be on main thread and must be synchronous
                                      dispatch_async(dispatch_get_main_queue(), ^{
                                        //  Payment handling code goes here
                                      });
                                  }
                                  else if (error) {
                                      dispatch_async(dispatch_get_main_queue(), ^{
                                          siriResponse = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeSuccess userActivity:nil];
                                      });
                                  }
                              }];
        }
}

如果我删除本地身份验证付款工作就好!!

0 个答案:

没有答案