Przeglądaj źródła

Update SwiftyStoreKit.swift

The function purchaseProduct() can leave without calling the completion handler if none of the if-lets will work out. The added lines will call the completion handler with an unknown error.
Achim Breidenbach 6 lat temu
rodzic
commit
46b5747d98
1 zmienionych plików z 3 dodań i 0 usunięć
  1. 3 0
      SwiftyStoreKit/SwiftyStoreKit.swift

+ 3 - 0
SwiftyStoreKit/SwiftyStoreKit.swift

@@ -57,6 +57,9 @@ public class SwiftyStoreKit {
                 let userInfo = [ NSLocalizedDescriptionKey: "Invalid product id: \(invalidProductId)" ]
                 let error = NSError(domain: SKErrorDomain, code: SKError.paymentInvalid.rawValue, userInfo: userInfo)
                 completion(.error(error: SKError(_nsError: error)))
+            } else {
+                let error = NSError(domain: SKErrorDomain, code: SKError.unknown.rawValue, userInfo: nil)
+                completion(.error(error: SKError(_nsError: error)))
             }
         }
     }