使用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];
});
}
}];
}
}
如果我删除本地身份验证付款工作就好!!