我正在尝试显示一个不是nil但未显示的PKPaymentAuthorizationViewController。 我曾经工作过,但现在已经不行了。 权利和商家ID似乎很好。 这是我的初始代码(没有无用的代码)
PKPaymentRequest *request = [PKPaymentRequest new];
request.merchantIdentifier = kApplePayMerchantId;
request.merchantCapabilities = PKMerchantCapability3DS;
request.supportedNetworks = self.class.supportedNetworks;
request.countryCode = _countryCode;
request.currencyCode = _currencyCode;
request.requiredShippingAddressFields = PKAddressFieldAll;
request.requiredBillingAddressFields = PKAddressFieldName | PKAddressFieldPostalAddress;
request.paymentSummaryItems = summaryItems;
PKPaymentAuthorizationViewController *paymentVC = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
paymentVC.delegate = self;
return paymentVC;
然后我用
显示它- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion;
但没有任何反应。没有记录...
我试图在return paymentVC;
之前设置断点,打印此对象(似乎没问题),然后按下Play,我有以下日志
Payment request is invalid: check your entitlements
苹果付费视图控制器出现并在BAD ACCESS错误中崩溃。
我真的不明白会发生什么。 你能帮我解决这个错误吗?
答案 0 :(得分:2)