在 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
请建议。