Browse Source

Print localized description when a purchase fails with .unknown error

Andrea Bizzotto 8 years ago
parent
commit
21cb17ad2f

+ 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.