0

在 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

请建议。

4

1 回答 1

0

帐单和送货地址存储在您的PKPayment.

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

于 2017-05-03T05:35:08.177 回答