What is the right approach to handle device LocalAuthentication
with NSIntent
? Currently it is not showing payment sent pop up in 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];
});
}
}];
}
}
If I remove Local Authentication payment works just fine!!