瀏覽代碼

Print localized description when a purchase fails with .unknown error

Andrea Bizzotto 8 年之前
父節點
當前提交
21cb17ad2f
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      SwiftyStoreKit-iOS-Demo/ViewController.swift
  2. 1 1
      SwiftyStoreKit-macOS-Demo/ViewController.swift

+ 1 - 1
SwiftyStoreKit-iOS-Demo/ViewController.swift

@@ -209,7 +209,7 @@ extension ViewController {
         case .error(let error):
             print("Purchase Failed: \(error)")
             switch error.code {
-            case .unknown: return alertWithTitle("Purchase failed", message: "Unknown error. Please contact support")
+            case .unknown: return alertWithTitle("Purchase failed", message: error.localizedDescription)
             case .clientInvalid: // client is not allowed to issue the request, etc.
                 return alertWithTitle("Purchase failed", message: "Not allowed to make the payment")
             case .paymentCancelled: // user cancelled the request, etc.

+ 1 - 1
SwiftyStoreKit-macOS-Demo/ViewController.swift

@@ -200,7 +200,7 @@ extension ViewController {
         case .error(let error):
             print("Purchase Failed: \(error)")
             switch error.code {
-            case .unknown: return alertWithTitle("Purchase failed", message: "Unknown error. Please contact support")
+            case .unknown: return alertWithTitle("Purchase failed", message: error.localizedDescription)
             case .clientInvalid: // client is not allowed to issue the request, etc.
                 return alertWithTitle("Purchase failed", message: "Not allowed to make the payment")
             case .paymentCancelled: // user cancelled the request, etc.