PKAddPassPaymentRequest无法发送请求

时间:2018-05-20 14:53:06

标签: objective-c applepay wallet

我正在开发Apple Pay Card卡配置Apple Pay In-App Provisioning Card我继续使用此功能获取nonce&来自Apple服务器的nonceSignatures在尝试在下面的formate中发送PKAddPassPaymentRequest后没有得到任何东西是格式是正确的我发送

PKAddPaymentPassRequest *request = [[PKAddPaymentPassRequest alloc] init];
request.encryptedPassData =[@"XXXXXXXXXXX" dataUsingEncoding:NSUTF8StringEncoding];
request.activationData =[@"XXXXXXXXXXX" dataUsingEncoding:NSUTF8StringEncoding];
request.ephemeralPublicKey =[@"XXXXXXXXXXX" dataUsingEncoding:NSUTF8StringEncoding];

提前致谢。

1 个答案:

答案 0 :(得分:2)

先决条件:获取所有权利和更新的个人资料。您只能通过testflight或appstore测试推送配置到生产。您可以通过Apple向您的设备请求沙箱环境。他们可以通过安装配置文件在您的设备中启用QA环境。然后,您也可以在QA环境中测试推送配置。

一旦满足所有要求,

<强> 1。创建配置并填写所需的详细信息

PKAddPaymentPassRequestConfiguration *config= 
     [[PKAddPaymentPassRequestConfiguration alloc] 
       initWithEncryptionScheme:PKEncryptionSchemeECC_V2];

<强> 2。创建PKAddPaymentPassViewController并显示它

self.addPaymentPassModal = 
     [[PKAddPaymentPassViewController alloc]
       initWithRequestConfiguration:config delegate:self];

第3。实施委托方法。

- (void)addPaymentPassViewController:(PKAddPaymentPassViewController *)controller 
generateRequestWithCertificateChain:(NSArray<NSData *> *)certificates
                           nonce:(NSData *)nonce
                  nonceSignature:(NSData *)nonceSignature
               completionHandler:(void(^)(PKAddPaymentPassRequest *request))handler {

  PKAddPaymentPassRequest *paymentPassRequest = [[PKAddPaymentPassRequest alloc] init];

  paymentPassRequest.encryptedPassData = [[NSData alloc]
                initWithBase64EncodedString:encryptedPassData options:0];

  paymentPassRequest.activationData = [activationData 
                 dataUsingEncoding:NSUTF8StringEncoding];

  paymentPassRequest.ephemeralPublicKey = [[NSData alloc] 
                 initWithBase64EncodedString:ephemeralPublicKey options:0];

  handler(paymentPassRequest);

}

- (void)addPaymentPassViewController:(PKAddPaymentPassViewController *)controller
      didFinishAddingPaymentPass:(nullable PKPaymentPass *)pass
                           error:(nullable NSError *)error {

 //Will get called once push provisioning complete

}