2017-07-03 81 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:... 

第二個是一個正確的初始化,首先是沒有。