PKPaymentAuthorizationViewController在iOS 8.4上意外崩溃 [英] PKPaymentAuthorizationViewController is crashing unexpectedly on iOS 8.4

查看:196
本文介绍了PKPaymentAuthorizationViewController在iOS 8.4上意外崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

后台:我在iOS 8.2,8.3上使用了相同的代码,但它运行正常。

Background: I used same code for iOS 8.2,8.3 it was working fine.

PKPaymentAuthorizationViewController *paymentPane = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
paymentPane.delegate = self;

[self presentViewController:paymentPane animated:TRUE completion:nil];

PaymentRequest代码:

        PKPaymentRequest *request = [[PKPaymentRequest alloc] init];


        NSString *chargeApplePay=[NSString stringWithFormat:@"%.02f",pay];

        PKPaymentSummaryItem *total = [PKPaymentSummaryItem summaryItemWithLabel:@"Grand Total"
                                                                          amount:[NSDecimalNumber decimalNumberWithString:chargeApplePay]];

        request.paymentSummaryItems = @[total];
        request.countryCode = @"US";
        request.currencyCode = @"USD";
        request.supportedNetworks = @[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa];
        request.merchantIdentifier = @"valid.com.myIdentifier";
        request.merchantCapabilities = PKMerchantCapability3DS;

问题:现在我在iOS 8.4上尝试展示我的payPane价值是以某种方式为零。

Question: Now on iOS 8.4 when I try to present my paymentPane its value is nil somehow.


致命异常:NSInvalidArgumentException应用程序尝试
在目标上显示一个nil模态视图控制器。

Fatal Exception: NSInvalidArgumentException Application tried to present a nil modal view controller on target .

我已经尝试使用Google搜索和使用stackoverflow的答案。


  • 二手支票

  • Used Checks like

[PKPaymentAuthorizationViewController    canMakePaymentsUsingNetworks:@[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa]] 

[PKPaymentAuthorizationViewController canMakePayments]

检查我的商家ID是否有效。

Checking my merchant id is valid or not.

推荐答案


  1. 检查磨她已经在您的设备中添加了信用卡信息 Passbook

检查您是否可以使用自己的设备付款。


目标C:

Check whether you can make payment using your device.

Objective C :

if ([PKPaymentAuthorizationViewController canMakePayments]) {
    NSLog(@"Can Make Payments");
}
else {
    NSLog(@"Can't Make payments");
}


Swift:

Swift :


if PKPaymentAuthorizationViewController.canMakePayments() {
    NSLog(@"Can Make Payments");
}
else {
    NSLog(@"Can't Make Payments");
}

NSArray *paymentNetworks = [NSArray arrayWithObjects:PKPaymentNetworkMasterCard, PKPaymentNetworkVisa, PKPaymentNetworkAmex, nil];
if ([PKPaymentAuthorizationViewController canMakePaymentsUsingNetworks:paymentNetworks]) {
    NSLog(@"Can Make payment with your card");
}
else {
    NSLog(@"Card is not supporting");
}


Swift:

Swift :


let paymentNetworks = [PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa]
if PKPaymentAuthorizationViewController.canMakePaymentsUsingNetworks(paymentNetworks) {
    NSLog(@"Can Make payment with your card");
}
else {
    NSLog(@"Card is not supporting");
}


这篇关于PKPaymentAuthorizationViewController在iOS 8.4上意外崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆