gpt4 book ai didi

ios - 无法从 PKPaymentAuthorizationViewController 委托(delegate)方法 didSelectShippingContact 内的 PKContact 访问电话号码、名字、街道

转载 作者:行者123 更新时间:2023-12-02 10:15:52 26 4
gpt4 key购买 nike

我正在使用 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]];

这是我现在一直使用的地址: enter image description here

在下面的屏幕截图中找到调试信息,其中显示 PKContact 对象“联系人”缺少所需信息。

enter image description here

enter image description here

enter image description here

最佳答案

我找到了解决方案,希望这可以帮助像我这样的人。

https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypayment/1916097-shippingcontact

上面的链接提示我无法在委托(delegate)方法“didSelectShippingContact”中获取完整的地址信息,而是只有在用户使用委托(delegate)中的 Touch ID、Face ID 或 Passcode 授权付款后才会提供该信息方法“didAuthorizePayment”。这里我们有一个 PKPayment(付款)对象,该对象包含我需要进一步处理以完成付款交易的所有地址/联系人字段。

enter image description here

关于ios - 无法从 PKPaymentAuthorizationViewController 委托(delegate)方法 didSelectShippingContact 内的 PKContact 访问电话号码、名字、街道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59968511/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com