paymentRequestWithMerchantIdentifier NSInvalidArgumentException错误

时间:2014-10-13 06:39:35

标签: ios stripe-payments

我正在尝试使用this链接在iOS应用中进行条带支付集成。

我收到以下错误:

    +[Stripe paymentRequestWithMerchantIdentifier:amount:currency:description:]: unrecognized selector sent to class 0x10ecc73d0
2014-10-13 12:04:50.029 stripeDemoApplePay[2507:71067] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[Stripe paymentRequestWithMerchantIdentifier:amount:currency:description:]: unrecognized selector sent to class 0x10ecc73d0'

以下是收到此错误的代码:

    - (IBAction)beginPayment:(id)sender {
    NSString *merchantId = @"my merchant id";
    NSInteger price = 10;
//    NSUInteger *numberOfShirts = ;
    NSDecimalNumber *amt = [NSDecimalNumber decimalNumberWithMantissa:price exponent:0 isNegative:NO];;
    PKPaymentRequest *paymentRequest = [Stripe paymentRequestWithMerchantIdentifier:merchantId
                                                                             amount:amt
                                                                           currency:@"USD"
                                                                        description:@"Premium Llama Food"]; //ERROR LINE
    [paymentRequest setRequiredShippingAddressFields:PKAddressFieldPostalAddress];
    [paymentRequest setRequiredBillingAddressFields:PKAddressFieldPostalAddress];

我哪里出错了?我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

看起来苹果改变了他们实施付款请求的方式,并且条纹跟随套件。下面是新的条带方法。确保您拥有最新的条带SDK。

+ (PKPaymentRequest *)paymentRequestWithMerchantIdentifier:(NSString *)merchantIdentifier;

查看PKPaymentRequest文档。最终的摘要项目现在是金额。

答案 1 :(得分:0)

由于Stripe在ApplePay类别顶部检查的编译时常量,我遇到了这个问题:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 && defined(STRIPE_ENABLE_APPLEPAY)

没有那些您尝试调用的方法将无法使用

Stripe+ApplePay category on github