2017-07-03 77 views
1

我已经实施Apple Pay及Target 8.4及以上版本。iOS中的Apple付款按钮8.4

当设备具有ApplePay功能但未配置时,我们必须打开电子钱包应用程序并启动添加购物车的过程。

当我实现iOS 8.4的代码时,不显示PKPaymentButton。 它在iOS 9.0上工作正常。请检查下面的代码是否相同。

if ([PKPaymentAuthorizationViewController canMakePayments]) { 
//   Card configured 

      self.btnApplePay = [self.btnApplePay initWithPaymentButtonType:PKPaymentButtonTypePlain paymentButtonStyle:PKPaymentButtonStyleBlack]; 
     } 
     else { 
//   Card not configured 

      self.btnApplePay = [PKPaymentButton buttonWithType:PKPaymentButtonTypeSetUp style:PKPaymentButtonStyleBlack]; 

     } 

此外,找到截图的附件。

This is for iOS 8.4 version

This is For iOS 9.0 Version

请建议,在那里我需要改善我的代码。

+0

您确定您正在测试iOS 8.4吗? 'PKPaymentButton'仅适用于iOS 8.4及更高版本。不支持iOS 8.3及更低版本。 – Mackarous

+0

是的我选择了iPhone 5(8.4) – Myaaoonn

回答

0

您正在使用两种不同的初始化方法。在第一个使用的是

[self.btnApplePay initWithPaymentButtonType... 

但在第二个使用的是

[PKPaymentButton buttonWithType:... 

第二个是一个正确的初始化,首先是没有。