- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 PKPaymentAuthorizationViewController 及其委托(delegate)方法集成 Apple Pay。当用户更改地址时,将触发以下委托(delegate)方法:
- (void)paymentAuthorizationViewController:(PKPaymentAuthorizationViewController *)controller didSelectShippingContact:(PKContact *)contact completion:(void (^)(PKPaymentAuthorizationStatus status, NSArray<PKShippingMethod *> *shippingMethods, NSArray<PKPaymentSummaryItem *> *summaryItems))completion
当我尝试从“联系人”访问电话号码时,它始终为空,而且姓名(名字、姓氏等)也为空。但所选的送货联系人拥有姓名、电话号码、邮政地址等所有信息。
PKPaymentRequest *pkPaymentRequest = [[PKPaymentRequest alloc] init];
pkPaymentRequest.merchantIdentifier = merchantId;
pkPaymentRequest.supportedNetworks = @[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa, PKPaymentNetworkDiscover];
pkPaymentRequest.merchantCapabilities = PKMerchantCapability3DS;
pkPaymentRequest.countryCode = @"US";
pkPaymentRequest.currencyCode = @"USD";
pkPaymentRequest.requiredShippingContactFields = [NSSet setWithArray:@[PKContactFieldPostalAddress, PKContactFieldName, PKContactFieldPhoneNumber]];
在下面的屏幕截图中找到调试信息,其中显示 PKContact 对象“联系人”缺少所需信息。
最佳答案
我找到了解决方案,希望这可以帮助像我这样的人。
上面的链接提示我无法在委托(delegate)方法“didSelectShippingContact”中获取完整的地址信息,而是只有在用户使用委托(delegate)中的 Touch ID、Face ID 或 Passcode 授权付款后才会提供该信息方法“didAuthorizePayment”。这里我们有一个 PKPayment(付款)对象,该对象包含我需要进一步处理以完成付款交易的所有地址/联系人字段。
关于ios - 无法从 PKPaymentAuthorizationViewController 委托(delegate)方法 didSelectShippingContact 内的 PKContact 访问电话号码、名字、街道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59968511/
这个问题在这里已经有了答案: Loading Apple Pay Shipping Address No Street (1 个回答) 关闭 7 年前。 我在 PKPaymentAuthorizat
我正在使用 PKPaymentAuthorizationViewController 及其委托(delegate)方法集成 Apple Pay。当用户更改地址时,将触发以下委托(delegate)方法
我是一名优秀的程序员,十分优秀!