فهرست منبع

Add additional default case in SKError.code switch when purchasing a product.

bizz84 6 سال پیش
والد
کامیت
d15cdb0511
3فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 2 0
      README.md
  2. 2 0
      SwiftyStoreKit-iOS-Demo/ViewController.swift
  3. 2 0
      SwiftyStoreKit-macOS-Demo/ViewController.swift

+ 2 - 0
README.md

@@ -170,6 +170,7 @@ SwiftyStoreKit.purchaseProduct("com.musevisions.SwiftyStoreKit.Purchase1", quant
         case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
         case .cloudServiceNetworkConnectionFailed: print("Could not connect to the network")
         case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
+        default: print((error as NSError).localizedDescription)
         }
     }
 }
@@ -197,6 +198,7 @@ SwiftyStoreKit.purchaseProduct("com.musevisions.SwiftyStoreKit.Purchase1", quant
         case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
         case .cloudServiceNetworkConnectionFailed: print("Could not connect to the network")
         case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
+        default: print((error as NSError).localizedDescription)
         }
     }
 }

+ 2 - 0
SwiftyStoreKit-iOS-Demo/ViewController.swift

@@ -299,6 +299,8 @@ extension ViewController {
                 return alertWithTitle("Purchase failed", message: "Could not connect to the network")
             case .cloudServiceRevoked: // user has revoked permission to use this cloud service
                 return alertWithTitle("Purchase failed", message: "Cloud service was revoked")
+            default:
+                return alertWithTitle("Purchase failed", message: (error as NSError).localizedDescription)
             }
         }
     }

+ 2 - 0
SwiftyStoreKit-macOS-Demo/ViewController.swift

@@ -205,6 +205,8 @@ extension ViewController {
                 return alertWithTitle("Purchase failed", message: "The purchase identifier was invalid")
             case .paymentNotAllowed: // this device is not allowed to make the payment
                 return alertWithTitle("Purchase failed", message: "The device is not allowed to make the payment")
+            default:
+                return alertWithTitle("Purchase failed", message: (error as NSError).localizedDescription)
             }
         }
     }