有没有办法检测它在Apple Pay PKPaymentAuthorizationViewController上触摸的取消按钮?

时间:2016-03-09 21:45:10

标签: ios applepay

只要PKPaymentAuthorizationViewController因任何原因被解雇,Apple Pay就会调用以下代理。有没有办法检测是否 取消按钮被触摸了?

- (void)paymentAuthorizationViewControllerDidFinish:(PKPaymentAuthorizationViewController *)controller
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

enter image description here

1 个答案:

答案 0 :(得分:7)

来自documentation for paymentAuthorizationViewControllerDidFinish

  

当用户授权付款请求时,在来自paymentAuthorizationViewController的状态之后调用此方法:didAuthorizePayment:completion:方法的完成块已显示给用户。当用户取消而未授权付款请求时,仅调用paymentAuthorizationViewControllerDidFinish:。

所以,如果

paymentAuthorizationViewController:didAuthorizePayment:completion:

首先没有调用,然后用户点击了取消按钮(否则控制器会以某种方式被取消)。