I am developing an App that allows a user to Add Cards a payment pass in the Wallet via the App. In order to do this, you must be request Apple to add the following entitlement
I'm also using "com.apple.developer.payment-pass-provisioning" these entitlements in my app Apple granted this entitlement for my team ID modified my provisioning profile with this entitlement enabled.
Trying to invoke the Add card screen in the Wallet app from My application using the below code
PKAddPaymentPassRequestConfiguration *request;
request.cardholderName = @"xxxxxxxx";
request.primaryAccountSuffix = @"xxxx";
request.localizedDescription = @"This will add the card to Apple Pay";
request.primaryAccountIdentifier = @"test";
request.paymentNetwork = @"Test";
PKPassLibrary *libra;
[libra openPaymentSetup];
PKAddPaymentPassViewController *vc = [[PKAddPaymentPassViewController alloc] initWithRequestConfiguration:request delegate:self];
vc.delegate = self;
[self presentViewController:vc animated:YES completion:nil];
App is getting crash. with the error passing Nil
value to the viewcontoller.
First create PKAddPaymentPassRequestConfiguration using an encryption scheme. Then create PKAddPaymentPassViewController using this config. Update all required details in the config variable.
PKAddPaymentPassRequestConfiguration *config =[[PKAddPaymentPassRequestConfiguration alloc] initWithEncryptionScheme:PKEncryptionSchemeECC_V2];
Have to Initialise the PKPassLibrary & PKPaymentPassRequestConfiguration replaced PKPassLibrary *libra;
with PKPassLibrary *libra = [[PKPassLibrary alloc] init];
来源:https://stackoverflow.com/questions/50173886/apple-pay-in-app-provisioning-card