在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
请建议。
账单和运输地址存储在您的PKPayment
实例中。
要获取带有付款帐单地址的PKContact
实例,只需使用myPKPayment.billingContact
。