【问题标题】:PKContact returns nil in iPadPKContact 在 iPad 中返回 nil
【发布时间】:2017-05-02 08:40:28
【问题描述】:

在 Apple Pay 中,我使用以下代码作为帐单地址。

    PKContact *contact = [[PKContact alloc] init];
    NSPersonNameComponents *name = [[NSPersonNameComponents alloc] init];
    name.givenName = cartAddress.firstName;
    name.familyName = cartAddress.lastName;

    contact.phoneNumber = [CNPhoneNumber phoneNumberWithStringValue:cartAddress.phoneNo];

    contact.name = name;

    CNMutablePostalAddress *address = [[CNMutablePostalAddress alloc] init];
    address.street = cartAddress.street;
    address.city = cartAddress.city;
    address.postalCode = cartAddress.postcode;
    address.ISOCountryCode = cartAddress.countryid ;

    contact.postalAddress = address;

它在 iPhone 上工作。但在 iPad 中返回 nil

 PKContact *contact = [[PKContact alloc] init]; // return nil

请提出建议。

【问题讨论】:

    标签: ios objective-c applepay passkit


    【解决方案1】:

    帐单和送货地址存储在您的PKPayment 实例中。

    要获取带有账单地址的PKContact 实例进行付款,只需使用myPKPayment.billingContact

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-09
      • 2015-12-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多